How to maintain precision using DateTime.Now.Ticks in C#

Posted by nmr on Stack Overflow See other posts from Stack Overflow or by nmr
Published on 2010-04-22T22:55:59Z Indexed on 2010/04/22 23:03 UTC
Read the original article Hit count: 230

Filed under:
|
|
|

I know that when I use DateTime.Now.Ticks in C# it returns a long value but I need to store it in an int variable and I am confused as to whether or not I can maintain that precision. As of right now I just have a cast

int timeStampValue = (int)DateTime.Now.Ticks;

Any suggestions or advice on how to maintain the precision, if possible, would be much appreciated.

© Stack Overflow or respective owner

Related posts about c#

Related posts about datetime