[PATCH] Fix ftime
Jakub Jelinek
jakub@redhat.com
Mon Mar 4 07:45:00 GMT 2002
Hi!
I couldn't find anything which would mandate this, but at least it is very
weird to have millitm = 1000 returned (in 0.0999% of cases) when it is supposed
to mean millisecond part of the time.
2002-03-04 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/bsd/ftime.c (ftime): Don't return 1000 in millitm.
--- libc/sysdeps/unix/bsd/ftime.c.jj Thu Aug 23 18:50:29 2001
+++ libc/sysdeps/unix/bsd/ftime.c Mon Mar 4 16:47:20 2002
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 1997, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -33,5 +33,10 @@ ftime (timebuf)
timebuf->millitm = (tv.tv_usec + 999) / 1000;
timebuf->timezone = tz.tz_minuteswest;
timebuf->dstflag = tz.tz_dsttime;
+ if (timebuf->millitm == 1000)
+ {
+ timebuf->time++;
+ timebuf->millitm = 0;
+ }
return 0;
}
Jakub
More information about the Libc-hacker
mailing list