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] |
On Thu, Jul 31, 2003 at 04:27:12PM +0200, Andreas Schwab wrote: > Jakub Jelinek <jakub@redhat.com> writes: > > |> The question is what is utimes/futimes supposed to do if > |> tv_usec > 999999. > > I can't find any requirement that the argument must be normalized, so > IMHO utimes should cope. 2003-07-31 Jakub Jelinek <jakub@redhat.com> * sysdeps/unix/sysv/linux/utimes.c (__utimes): Fix actime and modtime computation. * sysdeps/unix/sysv/linux/futimes.c (__futimes): Likewise. * sysdeps/posix/utimes.c (__utimes): Likewise. --- libc/sysdeps/unix/sysv/linux/utimes.c.jj 2003-07-14 17:15:43.000000000 -0400 +++ libc/sysdeps/unix/sysv/linux/utimes.c 2003-07-31 08:43:08.000000000 -0400 @@ -47,8 +47,8 @@ __utimes (const char *file, const struct if (tvp != NULL) { times = &buf; - buf.actime = tvp[0].tv_sec + tvp[0].tv_usec >= 500000; - buf.modtime = tvp[1].tv_sec + tvp[1].tv_usec >= 500000; + buf.actime = tvp[0].tv_sec + (tvp[0].tv_usec + 500000) / 1000000; + buf.modtime = tvp[1].tv_sec + (tvp[1].tv_usec + 500000) / 1000000; } else times = NULL; --- libc/sysdeps/unix/sysv/linux/futimes.c.jj 2003-07-16 06:10:01.000000000 -0400 +++ libc/sysdeps/unix/sysv/linux/futimes.c 2003-07-31 09:54:53.000000000 -0400 @@ -1,4 +1,4 @@ -/* futimes -- change access and modification times of open file. Stub version. +/* futimes -- change access and modification times of open file. Linux version. Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -58,8 +58,8 @@ __futimes (int fd, const struct timeval if (tvp != NULL) { times = &buf; - buf.actime = tvp[0].tv_sec + tvp[0].tv_usec >= 500000; - buf.modtime = tvp[1].tv_sec + tvp[1].tv_usec >= 500000; + buf.actime = tvp[0].tv_sec + (tvp[0].tv_usec + 500000) / 1000000; + buf.modtime = tvp[1].tv_sec + (tvp[1].tv_usec + 500000) / 1000000; } else times = NULL; --- libc/sysdeps/posix/utimes.c.jj 2001-07-06 00:56:01.000000000 -0400 +++ libc/sysdeps/posix/utimes.c 2003-07-31 10:32:18.000000000 -0400 @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1997, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1997, 2000, 2003 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 @@ -31,8 +31,8 @@ __utimes (const char *file, const struct if (tvp) { times = &buf; - times->actime = tvp[0].tv_sec + tvp[0].tv_usec / 1000000; - times->modtime = tvp[1].tv_sec + tvp[1].tv_usec / 1000000; + buf.actime = tvp[0].tv_sec + (tvp[0].tv_usec + 500000) / 1000000; + buf.modtime = tvp[1].tv_sec + (tvp[1].tv_usec + 500000) / 1000000; } else times = NULL; Jakub
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |