/* prototype to make compiler happy */
time_t __uuid_time(const uuid_t uu, struct timeval *ret_tv);
-static uint64_t gregorian_to_unix(uint64_t ts)
+static void gregorian_to_unix(uint64_t ts, struct timeval *tv)
{
const uint64_t offset = 0x01B21DD213814000ULL;
- return ts - offset;
+ uint64_t clock_reg = ts - offset;
+ tv->tv_sec = clock_reg / 10000000;
+ tv->tv_usec = (clock_reg % 10000000) / 10;
}
static void uuid_time_v1(const struct uuid *uuid, struct timeval *tv)
high = uuid->time_mid | ((uuid->time_hi_and_version & 0xFFF) << 16);
clock_reg = uuid->time_low | ((uint64_t) high << 32);
- clock_reg = gregorian_to_unix(clock_reg);
- tv->tv_sec = clock_reg / 10000000;
- tv->tv_usec = (clock_reg % 10000000) / 10;
+ gregorian_to_unix(clock_reg, tv);
}
static void uuid_time_v6(const struct uuid *uuid, struct timeval *tv)
clock_reg <<= 12;
clock_reg |= uuid->time_hi_and_version & 0xFFF;
- clock_reg = gregorian_to_unix(clock_reg);
- tv->tv_sec = clock_reg / 10000000;
- tv->tv_usec = (clock_reg % 10000000) / 10;
+ gregorian_to_unix(clock_reg, tv);
}
static void uuid_time_v7(const struct uuid *uuid, struct timeval *tv)