A
AzenAlex
Does anyone know what the C# equivalent of System.currentTimeMillis()
would be?
would be?
MrNobody said:And if you divide the number from Ticks by 10000 you get milliseconds.
so for example if what you wanted to do was time something, you could do:
long ticks = DateTime.Now.Ticks;
System.Threading.Thread.Sleep(20000);
Console.WriteLine((DateTime.Now.Ticks - ticks)/10000);
and it will correctly rprint 20000 (maybe plus a few milliseconds because of
the brief time it took to do the actual console.writeline)
I think what you want is:
DateTime.Now.Ticks
I kind of combined both ideas and it seems to work.
DateTime UtcNow = DateTime.UtcNow.Ticks;
DateTime baseTime = new DateTime(1970, 1, 1, 0, 0, 0);
long timeStamp = (UtcNow - baseTime).Ticks / 10000;
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.