Commit ee51fa4e authored by Frode Isaksen's avatar Frode Isaksen Committed by Pekka Pessi

su: fix su_time() on 64-bit OS X

The field tv_sec in struct timeval is 64bits instead of 32bits as in
su_time_t, so you cannot cast su_time_t to struct timeval.
parent c4a35104
......@@ -97,8 +97,11 @@ void su_time(su_time_t *tv)
}
#elif HAVE_GETTIMEOFDAY
if (tv) {
gettimeofday((struct timeval *)tv, NULL);
tv->tv_sec += NTP_EPOCH;
struct timeval timeval;
gettimeofday(&timeval, NULL);
tv->tv_sec = timeval.tv_sec + NTP_EPOCH;
tv->tv_usec = (unsigned long)timeval.tv_usec;
}
#elif HAVE_FILETIME
union {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment