How does DateTime.Now.Tick exactly work?
Posted
by
Roflcoptr
on Stack Overflow
See other posts from Stack Overflow
or by Roflcoptr
Published on 2010-12-29T12:36:40Z
Indexed on
2010/12/29
12:54 UTC
Read the original article
Hit count: 218
In my application I generate files at random opportunities. To ensure a unique naming, I tried to use the nano seconds since 1.1.1970:
long time = DateTime.Now.Ticks;
String fileName = Convert.ToString(time);
Console.WriteLine(fileName);
Now I observed something weird. Why is the output like that? I mean why are the last 4 numbers always the same? I can use this as a filename, that is not the problem, but I'm just wondering about it.
634292263478068039
634292263512888039
634292263541368039
634292263603448039
634292263680078039
© Stack Overflow or respective owner