aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-03-11 21:20:39 +0000
committerUlrich Drepper <drepper@redhat.com>2002-03-11 21:20:39 +0000
commit1396cb052d732254a453dae00c29f3a075a90cb3 (patch)
treeefb99056b923dce90cf03ec7c543eee99abd4344 /sysdeps
parent078405a203ba619acca622d0d2c36c40f54d77a5 (diff)
downloadglibc-1396cb052d732254a453dae00c29f3a075a90cb3.zip
glibc-1396cb052d732254a453dae00c29f3a075a90cb3.tar.gz
glibc-1396cb052d732254a453dae00c29f3a075a90cb3.tar.bz2
Round milli seconds to nearest. Don't return 1000 in millitm.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/bsd/ftime.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sysdeps/unix/bsd/ftime.c b/sysdeps/unix/bsd/ftime.c
index 9aa5af1..187c24c 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;