timespec_from_double has this initialized variable:
struct timespec ts = {
.tv_sec = s,
.tv_nsec = (s - (long)(s)) * NSEC_PER_SEC,
};
On platforms with 32-bit long and the usual Unix time epoch of Jan 1, 1970, this will suffer from the Year 2038 problem even if the platform uses a 64-bit time_t.
The C standard declares the tv_sec member to be of type time_t, so it should be sufficient to replace the conversion (long)(s) with (time_t)(s) (assuming time_t is an integer type because the existing code already assumes that!).