PM: fix clock_gettime() nanosecond overflow

Change-Id: I969b30862cb671200a26b55afe3d523b6cfd2a7c
This commit is contained in:
David van Moolenbroek 2013-10-26 14:40:21 +02:00 committed by Gerrit Code Review
parent 539d1e306a
commit 2e7c53b597

View file

@ -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);
}