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]

Re: [PATCH] Fix ftime


Jakub Jelinek <jakub@redhat.com> writes:

|> 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;

Perhaps we should actually truncate here instead of rounding up.

|>    timebuf->timezone = tz.tz_minuteswest;
|>    timebuf->dstflag = tz.tz_dsttime;
|> +  if (timebuf->millitm == 1000)
|> +    {
|> +      timebuf->time++;
|> +      timebuf->millitm = 0;
|> +    }
|>    return 0;
|>  }

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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