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 seconds | UTC | Why |
|---|---|---|
| 2147483646 | 2038-01-19 03:14:06 | Last-but-one good second |
| 2147483647 | 2038-01-19 03:14:07 | Last representable signed 32-bit second |
| 2147483648 | overflow | Does the API accept it, reject it, or wrap? |
| now + 10 years | varies | Backwards 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
- Create a file, set its mtime past 2038, unmount, remount,
statit. - Insert a row with a 2039 timestamp; read it back.
- Issue a certificate that expires in 2040; see whether the verifier accepts the dates.
- On NTP clients, check documented era handling before February 2036 — a different bug.