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.

Boundary values

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

Read the box before you change its clock

This prints clock width and filesystem limits. It does not set the time.

echo "long_bit $(getconf LONG_BIT 2>/dev/null)"
echo "timesize $(grep -h __TIMESIZE /usr/include/bits/timesize.h 2>/dev/null | head -1)"
df -T / | awk 'NR==2 {print "fs",$1,$2}'
tune2fs -l "$(findmnt -n -o SOURCE /)" 2>/dev/null | awk -F: '/Inode size/ {gsub(/ /,"",$2); print "inode",$2}'
xfs_info / 2>/dev/null | awk '/bigtime/ {print}'
mysql -N -e "SELECT table_schema, table_name, column_name FROM information_schema.columns WHERE data_type='timestamp'" 2>/dev/null | head

A 64 on the first line does not clear an inode size of 128 or a TIMESTAMP column. Those are separate counters. The calculator is for the install date: tools/calculator.html.

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