// rollover - emit dates across the 32-bit unix epoch rollover #include #include #include #include #include char buf[80]; void showtime(struct tm *tm) { strftime(buf, 79, "%Y-%m-%d %H:%M:%S", tm); printf("%s\n", buf); } int main(void) { struct tm *when; // OpenBSD already has a 64-bit epoch counter so we instead // force the use of a 32-bit counter int32_t nau = INT_MAX; time_t epoch = nau; when = gmtime(&epoch); showtime(when); nau++; epoch = nau; when = gmtime(&epoch); showtime(when); return 0; }