]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Initialize tv_usec fields.
authorRoland McGrath <roland@gnu.org>
Tue, 25 Oct 1994 03:34:28 +0000 (03:34 +0000)
committerRoland McGrath <roland@gnu.org>
Tue, 25 Oct 1994 03:34:28 +0000 (03:34 +0000)
Use __gettimeofday instead of time.

sysdeps/unix/bsd/utime.c

index 4916006734159f5caa4b21a95183c7f10b1609cb..c7ed20ffe321490adb56a487a8cbee235e64c93e 100644 (file)
@@ -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);
 }