diff options
author | Roland McGrath <roland@gnu.org> | 1994-10-25 03:34:28 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1994-10-25 03:34:28 +0000 |
commit | 068f2da651ccac3c6faf9c6a17f0488d94bd076f (patch) | |
tree | ea5d202f65fa7d1f6066aca08be39b56a9884376 | |
parent | 031dcb098957bbf2f4740beb371fb4b0f1c2be10 (diff) |
Initialize tv_usec fields.
Use __gettimeofday instead of time.
-rw-r--r-- | sysdeps/unix/bsd/utime.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sysdeps/unix/bsd/utime.c b/sysdeps/unix/bsd/utime.c index 4916006734..c7ed20ffe3 100644 --- a/sysdeps/unix/bsd/utime.c +++ b/sysdeps/unix/bsd/utime.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1994 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 @@ -35,14 +35,16 @@ DEFUN(utime, (file, times), CONST char *file AND CONST struct utimbuf *times) if (times != NULL) { timevals[0].tv_sec = (long int) times->actime; + timevals[0].tv_usec = 0L; timevals[1].tv_sec = (long int) times->modtime; + timevals[1].tv_usec = 0L; } else { - time_t now = time((time_t *) NULL); - timevals[0].tv_sec = (long int) now; - timevals[1].tv_sec = (long int) now; + if (__gettimeofday (&timevals[0], NULL) < 0) + return -1; + timevals[1] = timevals[0]; } - return __utimes(file, timevals); + return __utimes (file, timevals); } |