test-localtime.c 529 B

12345678910111213141516
  1. #include <stdio.h>
  2. #include <time.h>
  3. int main(int argc, char * argv[]) {
  4. time_t i = 1576000000;
  5. while (i < 2000000000) {
  6. struct tm * t = localtime(&i);
  7. if (t->tm_sec < 0 || t->tm_sec >= 60) fprintf(stderr, "Erroneous value at %ld: sec = %d\n", i, t->tm_sec);
  8. if (t->tm_min < 0 || t->tm_min >= 60) fprintf(stderr, "Erroneous value at %ld: min = %d\n", i, t->tm_min);
  9. if (t->tm_hour < 0 || t->tm_hour >= 24) fprintf(stderr, "Erroneous value at %ld (%s) hour = %d\n", i, asctime(t), t->tm_hour);
  10. i++;
  11. }
  12. return 0;
  13. }