Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不同语言版本获取当前系统时间的方式不同 #104

Open
Joker-Bomb opened this issue Jun 13, 2024 · 0 comments
Open

不同语言版本获取当前系统时间的方式不同 #104

Joker-Bomb opened this issue Jun 13, 2024 · 0 comments

Comments

@Joker-Bomb
Copy link

你好,最近我在阅读你的代码时,发现C#获取当前系统时间是用UTC时间,而Java是非UTC时间,这样设计是有啥考虑嘛?
C#

protected virtual long GetCurrentTimeTick()
{
    //return (long)(DateTime.UtcNow - BaseTime).Ticks;
    //return (long)(_StartTimeTick + Environment.TickCount);
    return (long)(DateTime.UtcNow - BaseTime).TotalMilliseconds;
}

Java

protected long GetCurrentTimeTick() {
    long millis = System.currentTimeMillis();
    return millis - BaseTime;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant