I’ve discovered a “funny” issue with using an uint64_t variable.
The program:
#include
#include
#include
int main (int argc, char *argv[]) {
uint64_t ll;
ll = 20060430191242369LL; // timestamp: date time with millis
printf(“1) ll=%lld\n”, ll);
ll = 00000030000000000LL; // timestamp: number of days
printf(“2) ll=%lld\n”, ll);
ll = 030000000000LL; // timestamp: number of days
printf(“3) ll=%lld\n”, ll);
ll = 30000000000LL; // timestamp: number of days
printf(“4) ll=%lld\n”, ll);
return EXIT_SUCCESS;
}
The result:
1) ll=20060430191242369 2) ll=3221225472 3) ll=3221225472 4) ll=30000000000You see?
One or more leading zeroes messes things up (line 2 & 3 I would expect to be identical to line 4).
Am I wrong or is this a compiler issue?
Thanks,
Jacob Dall