From b5a497e9a7cd8a668b6384f1df2bbea1ca6c98d0 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Tue, 20 Feb 1996 18:34:51 +0000 Subject: (diskfs_set_node_times): Use maptime_read. --- libdiskfs/node-times.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) (limited to 'libdiskfs/node-times.c') diff --git a/libdiskfs/node-times.c b/libdiskfs/node-times.c index 54df9c0e..720c85e0 100644 --- a/libdiskfs/node-times.c +++ b/libdiskfs/node-times.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1994 Free Software Foundation + Copyright (C) 1994, 1996 Free Software Foundation This file is part of the GNU Hurd. @@ -20,49 +20,45 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Written by Michael I. Bushnell. */ #include "priv.h" +#include /* If NP->dn_set_ctime is set, then modify NP->dn_stat.st_ctime appropriately; do the analogous operation for atime and mtime as well. */ void diskfs_set_node_times (struct node *np) { - int secs, usecs; - - do - { - secs = diskfs_mtime->seconds; - usecs = diskfs_mtime->microseconds; - } - while (secs != diskfs_mtime->check_seconds); - + struct timeval t; + + maptime_read (diskfs_mtime, &t); + if (np->dn_set_mtime) { #ifdef notyet - np->dn_stat.st_mtimespec.ts_sec = secs; - np->dn_stat.st_mtimespec.ts_nsec = usecs * 1000; + np->dn_stat.st_mtimespec.ts_sec = t.tv_sec; + np->dn_stat.st_mtimespec.ts_nsec = t.tv_usec * 1000; #else - np->dn_stat.st_mtime = secs; - np->dn_stat.st_mtime_usec = usecs; + np->dn_stat.st_mtime = t.tv_sec; + np->dn_stat.st_mtime_usec = t.tv_usec; #endif } if (np->dn_set_atime) { #ifdef notyet - np->dn_stat.st_atimespec.ts_sec = secs; - np->dn_stat.st_atimespec.ts_nsec = usecs * 1000; + np->dn_stat.st_atimespec.ts_sec = t.tv_sec; + np->dn_stat.st_atimespec.ts_nsec = t.tv_usec * 1000; #else - np->dn_stat.st_atime = secs; - np->dn_stat.st_atime_usec = usecs; + np->dn_stat.st_atime = t.tv_sec; + np->dn_stat.st_atime_usec = t.tv_usec; #endif } if (np->dn_set_ctime) { #ifdef notyet - np->dn_stat.st_ctimespec.ts_sec = secs; - np->dn_stat.st_ctimespec.ts_nsec = usecs * 1000; + np->dn_stat.st_ctimespec.ts_sec = t.tv_sec; + np->dn_stat.st_ctimespec.ts_nsec = t.tv_usec * 1000; #else - np->dn_stat.st_ctime = secs; - np->dn_stat.st_ctime_usec = usecs; + np->dn_stat.st_ctime = t.tv_sec; + np->dn_stat.st_ctime_usec = t.tv_usec; #endif } -- cgit v1.2.3