From: Ulrich Drepper Date: Mon, 11 Mar 2002 21:20:39 +0000 (+0000) Subject: Round milli seconds to nearest. Don't return 1000 in millitm. X-Git-Tag: cvs/glibc-2-3~1002 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1396cb052d732254a453dae00c29f3a075a90cb3;p=thirdparty%2Fglibc.git Round milli seconds to nearest. Don't return 1000 in millitm. --- diff --git a/sysdeps/unix/bsd/ftime.c b/sysdeps/unix/bsd/ftime.c index 9aa5af100cd..187c24c1d39 100644 --- a/sysdeps/unix/bsd/ftime.c +++ b/sysdeps/unix/bsd/ftime.c @@ -30,7 +30,12 @@ ftime (timebuf) return -1; timebuf->time = tv.tv_sec; - timebuf->millitm = (tv.tv_usec + 999) / 1000; + timebuf->millitm = (tv.tv_usec + 500) / 1000; + if (timebuf->millitm == 1000) + { + ++timebuf->time; + timebuf->millitm = 0; + } timebuf->timezone = tz.tz_minuteswest; timebuf->dstflag = tz.tz_dsttime; return 0;