From: Kiran Rangoon Date: Mon, 29 Dec 2025 03:50:57 +0000 (-0500) Subject: libuuid: simplify gregorian-to-unix offset calculation X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75899c802366466ee988c0080202719bbd97747d;p=thirdparty%2Futil-linux.git libuuid: simplify gregorian-to-unix offset calculation Replace complex bit-shift offset calculation with a simple constant definition for better readability and maintainability. Signed-off-by: Kiran Rangoon Reviewed-by: Thomas Weißschuh --- diff --git a/libuuid/src/uuid_time.c b/libuuid/src/uuid_time.c index c7516152b..e2b991d74 100644 --- a/libuuid/src/uuid_time.c +++ b/libuuid/src/uuid_time.c @@ -62,7 +62,8 @@ time_t __uuid_time(const uuid_t uu, struct timeval *ret_tv); static uint64_t gregorian_to_unix(uint64_t ts) { - return ts - ((((uint64_t) 0x01B21DD2) << 32) + 0x13814000); + const uint64_t offset = 0x01B21DD213814000ULL; + return ts - offset; } static void uuid_time_v1(const struct uuid *uuid, struct timeval *tv)