From: David van Moolenbroek Date: Sat, 26 Oct 2013 12:40:21 +0000 (+0200) Subject: PM: fix clock_gettime() nanosecond overflow X-Git-Tag: v3.3.0~727 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/CHANGES?a=commitdiff_plain;h=refs%2Fchanges%2F71%2F1071%2F2;p=minix.git PM: fix clock_gettime() nanosecond overflow Change-Id: I969b30862cb671200a26b55afe3d523b6cfd2a7c --- diff --git a/servers/pm/time.c b/servers/pm/time.c index 40a73e00d..49e554cdd 100644 --- a/servers/pm/time.c +++ b/servers/pm/time.c @@ -41,7 +41,8 @@ int do_gettime() } mp->mp_reply.reply_time = (time_t) (boottime + (clock / system_hz)); - mp->mp_reply.reply_ntime = (clock % system_hz) * 1000000000 / system_hz; + mp->mp_reply.reply_ntime = + (long) ((clock % system_hz) * 1000000000ULL / system_hz); return(OK); } @@ -103,7 +104,8 @@ int do_time() panic("do_time couldn't get uptime: %d", s); mp->mp_reply.reply_time = (time_t) (boottime + (realtime / system_hz)); - mp->mp_reply.reply_utime = (realtime % system_hz) * 1000000 / system_hz; + mp->mp_reply.reply_utime = + (long) ((realtime % system_hz) * 1000000ULL / system_hz); return(OK); }