Home / Testing

Practice

How to test

Do not set a production clock to 2038. Build a disposable image, feed it the boundary values, and watch logs, files and certificates.

Values worth using

Unix secondsUTCWhy
21474836462038-01-19 03:14:06Last-but-one good second
21474836472038-01-19 03:14:07Last representable signed 32-bit second
2147483648overflowDoes the API accept it, reject it, or wrap?
now + 10 yearsvariesBackwards Risk for a 10-year warranty

C smoke test

#include <stdio.h>
#include <time.h>
int main(void) {
  time_t t = (time_t)2147483647;
  printf("time_t bytes=%zu last=%s", sizeof(time_t), ctime(&t));
  t = (time_t)2147483648U;
  printf("plus1=%s", ctime(&t));
}

If sizeof(time_t) is 4, you are looking at a time32 ABI. If it is 8, the language binding is clear; your files and columns may not be.

Operational tests