This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix ftime


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]