Skip to content

time: use dbus_int64_t for seconds instead of long

Alexander Kanavin requested to merge alex.kanavin/dbus:fix-y2038 into master

On 32 bit systems long will overflow in 2038, causing complete breakage. This is confirmed by running dbus's test suite on a 32 bit system with system time set to 2040 (and configured to use 64 bit time_t of course).

Note that both timespec and timeval are specified with time_t for the seconds component. This should propagate everywhere where that data is passed and stored, but previously _dbus_get_monotonic_time() and _dbus_get_monotonic_time() would truncate it to long.

Also add a function for parsing dbus_int64_t from files, as existing functions can only handle long.

Signed-off-by: Alexander Kanavin

Edited by Alexander Kanavin

Merge request reports