]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Round milli seconds to nearest. Don't return 1000 in millitm.
authorUlrich Drepper <drepper@redhat.com>
Mon, 11 Mar 2002 21:20:39 +0000 (21:20 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 11 Mar 2002 21:20:39 +0000 (21:20 +0000)
sysdeps/unix/bsd/ftime.c

index 9aa5af100cd8d81949d97963b0800e43359bb4a7..187c24c1d39e0bb49112e62056639be65a982a6e 100644 (file)
@@ -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;