I installed the attached proposed patch, which adds a tzcode option to periodically poll the TZif file to see whether it changed. You can enable this option by compiling with -DTZ_CHANGE_INTERVAL=61 (or choose your own favorite polling interval instead of 61 seconds). The option affects localtime and other functions whose behavior depends on the TZ environment variable (or its absence); it does not affect tzalloc-related functions. This patch affects tzcode's behavior only if you compile with the new option. The remaining major difference between the functionalities of tzcode and FreeBSD is FreeBSD's support for calling localtime (not localtime_r) from multiple threads. I plan to take a look at that some time soon, with the idea of adding that as another tzcode option. While preparing this patch I noticed some issues in FreeBSD localtime.c, noted below. The attached patch addresses these issues. * A bug can occur in the first minute after reboot, where FreeBSD’s tzdata_is_fresh assumes that since the monotonic clock is less than 61, the cache must be fresh. * Prefer CLOCK_MONOTONIC_COARSE aka CLOCK_MONOTONIC_FAST if available, as its precision suffices here and it should be more efficient than CLOCK_MONOTONIC. * When checking the file timestamp, the code should not fail merely because fstat fails due to EOVERFLOW. Instead, it should assume the file has changed, as this results in better behavior for the user. * When checking the file timestamp the code should not use strlcpy to copy its name. The strlcpy could silently truncate the name in the unlikely case where a relative file name is shorter than PATH_MAX but the absolute file name is not. More importantly, the file contents are what matter here, and since the file name does not matter there is no need to copy it. * It’s a bit better to check st_ctim, not just st_ctime, as st_ctim has subsecond resolution and is more likely to avoid false matches on platforms with dicey st_dev or st_ino. * For efficiency do not bother checking st_mtim/st_mtime, as st_ctim is updated whenever st_mtim is. * For efficiency do not call fstat twice in the unlikely case where TZ is an absolute pathname. * tzdata_is_fresh is poorly named, as it returns 0 if the cache is fresh, 1 if not. And as a nit, in traditional English, “data” is a plural word. The attached patch uses a function fresh_tzdata instead, with the more common interpretation of true and false. * The attached patch ports to platforms with 32-bit time_t and without tm_gmtoff. On these platforms, strftime.c includes localtime.c and localtime.h uses ‘#define time_t timex_t’. For this reason, fresh_tzdata cannot use time_t (which might be timex_t); it needs to use the underlying system time_t. * The attached patch ports to platforms lacking <sys/stat.h>, struct timespec, clock_gettime, or CLOCK_MONOTONIC/CLOCK_MONOTONIC_COARSE.