Hello all,
I'm trying to add two numbers, one is seconds and the other is nanoseconds (both in float), but when I do, my results don't come out correctly.
Can anyone help?
(I tried to expand the code out so that it can be easily examined)
Code:
float endingnano = (float)final.tv_nsec/1000000000;
float endingsec = final.tv_sec;
printf("Ending Nanoseconds = %f\n", endingnano);
printf("Ending Seconds = %f\n", endingsec);
float endingTime = endingnano + endingsec;
printf("Ending Time = %f\n", endingTime);
Results:
Ending Nanoseconds = 0.324691
Ending Seconds = 1318214528.000000
Ending Time = 1318214528.000000