Java System.currentTimeMillis() equivalent in C#

前端 未结 11 1108
-上瘾入骨i
-上瘾入骨i 2020-12-13 01:18

What is the equivalent of Java\'s System.currentTimeMillis() in C#?

11条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 02:07

    A common idiom in Java is to use the currentTimeMillis() for timing or scheduling purposes, where you're not interested in the actual milliseconds since 1970, but instead calculate some relative value and compare later invocations of currentTimeMillis() to that value.

    If that's what you're looking for, the C# equivalent is Environment.TickCount.

提交回复
热议问题