This is driving me crazy. I have a code which is outputting a weird value while using division:
#define NANOSECONDS_PER_SECOND 1000000000
uint64 CurrentTimeInNanoSecs;
uint64 GetTimeInNanoSecs( )
{
printf("\n%X", (CurrentTimeInNanoSecs >> 32) );
printf("\n%X", (CurrentTimeInNanoSecs & 0xFFFFFFFF) );
return ( CurrentTimeInNanoSecs );
}
void GetCurrentTimeInSecs()
{
uint32 Time = GetTimeInNanoSecs() / NANOSECONDS_PER_SECOND;
printf("%X", time);
}
void main()
{
GetCurrentTimeInSecs();
}
On init, I see the prints as follows: 0x00000000 0x3016DC6B 0x00000198
I am not sure what is happening. Can someone pls help.
GetTimeInNanoSecs
before calling it? The posted code doesn't show it. Without declaring it, you should have gotten a warning, and of course it won't work since it will implicitly treat the return type asint
.func
(from a function returning nothing) and the strange comment-like--- this is a...
. In this situation, answering is too much based on guessing and assumptions. Please take Somes hint and demonstrate your problem wih a MRE.