C# - version of Java currentTimeMillis
Java System.currentTimeMillis() is a very good utility to measure time in Java. However, in C#, it uses Ticks. There is 2 simple way to have a similar version of it
1. Use System.Environment.TickCount, it will return the number of millis elapsed since system started.
2. Use DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond, this will convert current time in Ticks to millisecond.
1. Use System.Environment.TickCount, it will return the number of millis elapsed since system started.
2. Use DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond, this will convert current time in Ticks to millisecond.
Comments
Post a Comment