In my MFC program i have a Unsigned __int64 variable TimeStamp,
This time stamp is a value of time in nano seconds,
I need to convert this variable into float so that I can convert this variable into seconds and minutes as decimal value and the fractioned value as milli seconds
I am unable to convert this variable into a unsigned float variable (which can hold 8 bytes of data ).
Ex: TimeStamp = 34587692012 nano seconds
converting this value to seconds it will be 34.587692012 seconds (Formula is TimeStamp/1000000000)
please let me know the convertion type.
Thanks in advance.
You might want to use double instead of float. They're very similar, but double normally uses two times as much memory as float and is therefore more accurate.
Also there's no such thing as unsigned float or unsigned double, unlike integers, they're always signed.
1 2 3 4 5
double var = TimeStamp / 1000000000.0; // take note of the ending .0
// or if you want it to be more obvious
double var = static_cast<double> (TimeStamp) / 1000000000;
The point is, for the division to yield a double, at least one of the operands must be double.