diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/make/Makefile | 3 | ||||
-rw-r--r-- | usr.bin/make/arch.c | 105 | ||||
-rw-r--r-- | usr.bin/make/dir.c | 32 | ||||
-rw-r--r-- | usr.bin/make/dir.h | 3 | ||||
-rw-r--r-- | usr.bin/make/extern.h | 4 | ||||
-rw-r--r-- | usr.bin/make/job.c | 8 | ||||
-rw-r--r-- | usr.bin/make/main.c | 9 | ||||
-rw-r--r-- | usr.bin/make/make.c | 30 | ||||
-rw-r--r-- | usr.bin/make/make.h | 39 | ||||
-rw-r--r-- | usr.bin/make/targ.c | 16 |
10 files changed, 142 insertions, 107 deletions
diff --git a/usr.bin/make/Makefile b/usr.bin/make/Makefile index 47c2912f9b9..f2642fac1ee 100644 --- a/usr.bin/make/Makefile +++ b/usr.bin/make/Makefile @@ -1,8 +1,9 @@ -# $OpenBSD: Makefile,v 1.23 2000/09/14 13:56:14 espie Exp $ +# $OpenBSD: Makefile,v 1.24 2000/11/24 14:36:33 espie Exp $ PROG= make CFLAGS+= -I${.OBJDIR} -I${.CURDIR} -Wall -Wno-char-subscripts -Wstrict-prototypes +CFLAGS+=-DUSE_TIMESPEC .if (${MACHINE_ARCH} == "m88k") CFLAGS+=-O0 .endif diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c index 3f9fdd35ae8..fb42a6c4813 100644 --- a/usr.bin/make/arch.c +++ b/usr.bin/make/arch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arch.c,v 1.36 2000/10/13 08:30:49 espie Exp $ */ +/* $OpenBSD: arch.c,v 1.37 2000/11/24 14:36:33 espie Exp $ */ /* $NetBSD: arch.c,v 1.17 1996/11/06 17:58:59 christos Exp $ */ /* @@ -108,7 +108,7 @@ static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94"; #else UNUSED -static char rcsid[] = "$OpenBSD: arch.c,v 1.36 2000/10/13 08:30:49 espie Exp $"; +static char rcsid[] = "$OpenBSD: arch.c,v 1.37 2000/11/24 14:36:33 espie Exp $"; #endif #endif /* not lint */ @@ -580,7 +580,7 @@ ArchMTimeMember(archive, member, hash) arch = ArchFindMember(archive, member, &sarh, "r"); if (arch == NULL) - return NULL; + return result; else { fclose(arch); grab_date( (time_t)strtol(sarh.ar_date, NULL, 10), result); @@ -594,7 +594,7 @@ ArchMTimeMember(archive, member, hash) */ arch = fopen(archive, "r"); if (arch == NULL) - return (NULL); + return result; /* * We use the ARMAG string to make sure this is an archive we @@ -603,7 +603,7 @@ ArchMTimeMember(archive, member, hash) if ((fread(magic, SARMAG, 1, arch) != 1) || (strncmp(magic, ARMAG, SARMAG) != 0)) { fclose(arch); - return NULL; + return result; } ar = (Arch *)emalloc(sizeof (Arch)); @@ -990,7 +990,7 @@ Arch_Touch (gn) arch = ArchFindMember(Varq_Value(ARCHIVE_INDEX, gn), Varq_Value(MEMBER_INDEX, gn), &arh, "r+"); - sprintf(arh.ar_date, "%-12ld", (long) now); + sprintf(arh.ar_date, "%-12ld", (long) timestamp2time_t(now)); if (arch != NULL) { (void)fwrite ((char *)&arh, sizeof (struct ar_hdr), 1, arch); @@ -1020,17 +1020,15 @@ Arch_TouchLib (gn) #ifdef RANLIBMAG FILE * arch; /* Stream open to archive */ struct ar_hdr arh; /* Header describing table of contents */ - struct utimbuf times; /* Times for utime() call */ arch = ArchFindMember (gn->path, RANLIBMAG, &arh, "r+"); - sprintf(arh.ar_date, "%-12ld", (long) now); + sprintf(arh.ar_date, "%-12ld", (long) timestamp2time_t(now)); if (arch != NULL) { (void)fwrite ((char *)&arh, sizeof (struct ar_hdr), 1, arch); fclose (arch); - times.actime = times.modtime = now; - utime(gn->path, ×); + set_times(gn->path); } #endif } @@ -1072,48 +1070,37 @@ Arch_MemMTime (gn) GNode *gn; { LstNode ln; - GNode *pgn; - char *nameStart, - *nameEnd; - Lst_Open(&gn->parents); - while ((ln = Lst_Next(&gn->parents)) != NULL) { + for (ln = Lst_First(&gn->parents); ln != NULL; ln = Lst_Adv(ln)) { + GNode *pgn; + char *nameStart, + *nameEnd; + pgn = (GNode *)Lst_Datum(ln); if (pgn->type & OP_ARCHV) { - /* - * If the parent is an archive specification and is being made + /* If the parent is an archive specification and is being made * and its member's name matches the name of the node we were * given, record the modification time of the parent in the * child. We keep searching its parents in case some other - * parent requires this child to exist... - */ - /* OpenBSD: less ugly check for nameStart == NULL */ - if ((nameStart = strchr (pgn->name, '(') ) != NULL) { + * parent requires this child to exist... */ + if ((nameStart = strchr(pgn->name, '(') ) != NULL) { nameStart++; - nameEnd = strchr (nameStart, ')'); + nameEnd = strchr(nameStart, ')'); } else nameEnd = NULL; if (pgn->make && nameEnd != NULL && - strncmp(nameStart, gn->name, nameEnd - nameStart) == 0) { - if (Arch_MTime(pgn)) - gn->mtime = pgn->mtime; - else - gn->mtime = OUT_OF_DATE; - } + strncmp(nameStart, gn->name, nameEnd - nameStart) == 0 && + gn->name[nameEnd-nameStart] == '\0') + gn->mtime = Arch_MTime(pgn); } else if (pgn->make) { - /* - * Something which isn't a library depends on the existence of - * this target, so it needs to exist. - */ - gn->mtime = OUT_OF_DATE; + /* Something which isn't a library depends on the existence of + * this target, so it needs to exist. */ + set_out_of_date(gn->mtime); break; } } - - Lst_Close(&gn->parents); - return gn->mtime; } @@ -1198,36 +1185,32 @@ Boolean Arch_LibOODate (gn) GNode *gn; /* The library's graph node */ { - Boolean oodate; - - if (OP_NOP(gn->type) && Lst_IsEmpty(&gn->children)) { - oodate = FALSE; - } else if (gn->mtime > now || gn->mtime < gn->cmtime || - gn->mtime == OUT_OF_DATE) { - oodate = TRUE; - } else { + TIMESTAMP modTimeTOC; /* mod time of __.SYMDEF */ + + if (OP_NOP(gn->type) && Lst_IsEmpty(&gn->children)) + return FALSE; + if (is_before(now, gn->mtime) || is_before(gn->mtime, gn->cmtime) || + is_out_of_date(gn->mtime)) + return TRUE; #ifdef RANLIBMAG - time_t modTimeTOC; /* The table-of-contents's mod time */ + /* non existent libraries are always out-of-date. */ + if (gn->path == NULL) + return TRUE; - modTimeTOC = ArchMTimeMember(gn->path, RANLIBMAG, FALSE); + modTimeTOC = ArchMTimeMember(gn->path, RANLIBMAG, FALSE); - if (!is_out_of_date(modTimeTOC)) { - if (DEBUG(ARCH) || DEBUG(MAKE)) - printf("%s modified %s...", RANLIBMAG, Targ_FmtTime(modTimeTOC)); - oodate = is_before(modTimeTOC, gn->cmtime); - } else { - /* - * A library w/o a table of contents is out-of-date - */ - if (DEBUG(ARCH) || DEBUG(MAKE)) - printf("No t.o.c...."); - oodate = TRUE; - } + if (!is_out_of_date(modTimeTOC)) { + if (DEBUG(ARCH) || DEBUG(MAKE)) + printf("%s modified %s...", RANLIBMAG, Targ_FmtTime(modTimeTOC)); + return is_before(modTimeTOC, gn->cmtime); + } + /* A library w/o a table of contents is out-of-date */ + if (DEBUG(ARCH) || DEBUG(MAKE)) + printf("No t.o.c...."); + return TRUE; #else - oodate = FALSE; + return FALSE; #endif - } - return (oodate); } /*- diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c index 18140e01047..36d45ff2253 100644 --- a/usr.bin/make/dir.c +++ b/usr.bin/make/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.28 2000/11/24 14:27:19 espie Exp $ */ +/* $OpenBSD: dir.c,v 1.29 2000/11/24 14:36:33 espie Exp $ */ /* $NetBSD: dir.c,v 1.14 1997/03/29 16:51:26 christos Exp $ */ /* @@ -96,7 +96,7 @@ static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; #else UNUSED -static char rcsid[] = "$OpenBSD: dir.c,v 1.28 2000/11/24 14:27:19 espie Exp $"; +static char rcsid[] = "$OpenBSD: dir.c,v 1.29 2000/11/24 14:36:33 espie Exp $"; #endif #endif /* not lint */ @@ -874,7 +874,7 @@ Dir_FindFile(name, path) /* Save the modification time so if it's needed, we don't have * to fetch it again. */ if (DEBUG(DIR)) - printf("Caching %s for %s\n", Targ_FmtTime(stb.st_mtime), + printf("Caching %s for %s\n", Targ_FmtTime(mtime), file); record_stamp(file, mtime); nearmisses += 1; @@ -938,7 +938,7 @@ Dir_FindFile(name, path) grab_stat(stb, mtime); if (DEBUG(DIR)) - printf("Caching %s for %s\n", Targ_FmtTime(stb.st_mtime), + printf("Caching %s for %s\n", Targ_FmtTime(mtime), name); record_stamp(name, mtime); return estrdup(name); @@ -1004,7 +1004,7 @@ Dir_MTime(gn) if (gn->type & OP_MEMBER) { if (fullName != gn->path) free(fullName); - return Arch_MemMTime (gn); + return Arch_MemMTime(gn); } else set_out_of_date(mtime); } @@ -1272,3 +1272,25 @@ Dir_PrintPath(path) { Lst_Every(path, DirPrintDir); } + +#ifndef USE_TIMESPEC +#include <sys/types.h> +#include <utime.h> +#endif +int +set_times(f) + const char *f; +{ +#ifdef USE_TIMESPEC + struct timeval tv[2]; + + TIMESPEC_TO_TIMEVAL(&tv[0], &now); + TIMESPEC_TO_TIMEVAL(&tv[1], &now); + return utimes(f, tv); +#else + struct utimbuf times; + + times.actime = times.modtime = now; + return utime(f, ×); +#endif +} diff --git a/usr.bin/make/dir.h b/usr.bin/make/dir.h index 30dcc147623..a4de9798461 100644 --- a/usr.bin/make/dir.h +++ b/usr.bin/make/dir.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.h,v 1.11 2000/11/24 14:27:19 espie Exp $ */ +/* $OpenBSD: dir.h,v 1.12 2000/11/24 14:36:33 espie Exp $ */ /* $NetBSD: dir.h,v 1.4 1996/11/06 17:59:05 christos Exp $ */ /* @@ -69,5 +69,6 @@ extern void Dir_PrintDirectories __P((void)); extern void Dir_PrintPath __P((Lst)); extern void Dir_Destroy __P((void *)); extern void *Dir_CopyDir __P((void *)); +extern int set_times __P((const char *)); #endif /* _DIR */ diff --git a/usr.bin/make/extern.h b/usr.bin/make/extern.h index a558f1dad8f..17c3593030d 100644 --- a/usr.bin/make/extern.h +++ b/usr.bin/make/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.35 2000/11/24 14:29:55 espie Exp $ */ +/* $OpenBSD: extern.h,v 1.36 2000/11/24 14:36:34 espie Exp $ */ /* $NetBSD: nonints.h,v 1.12 1996/11/06 17:59:19 christos Exp $ */ /*- @@ -139,7 +139,7 @@ extern Boolean Targ_Silent __P((GNode *)); extern Boolean Targ_Precious __P((GNode *)); extern void Targ_SetMain __P((GNode *)); extern void Targ_PrintCmd __P((void *)); -extern char *Targ_FmtTime __P((time_t)); +extern char *Targ_FmtTime __P((TIMESTAMP)); extern void Targ_PrintType __P((int)); extern void Targ_PrintGraph __P((int)); diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index 83cc5c4615e..5692dba1098 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -1,4 +1,4 @@ -/* $OpenBSD: job.c,v 1.37 2000/09/14 13:52:42 espie Exp $ */ +/* $OpenBSD: job.c,v 1.38 2000/11/24 14:36:34 espie Exp $ */ /* $NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $ */ /* @@ -126,7 +126,7 @@ static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else UNUSED -static char rcsid[] = "$OpenBSD: job.c,v 1.37 2000/09/14 13:52:42 espie Exp $"; +static char rcsid[] = "$OpenBSD: job.c,v 1.38 2000/11/24 14:36:34 espie Exp $"; #endif #endif /* not lint */ @@ -1009,7 +1009,6 @@ Job_Touch(gn, silent) Boolean silent; /* TRUE if should not print messages */ { int streamID; /* ID of stream opened to do the touch */ - struct utimbuf times; /* Times for utime() call */ if (gn->type & (OP_JOIN|OP_USE|OP_EXEC|OP_OPTIONAL)) { /* @@ -1035,8 +1034,7 @@ Job_Touch(gn, silent) } else { char *file = gn->path ? gn->path : gn->name; - times.actime = times.modtime = now; - if (utime(file, ×) < 0){ + if (set_times(file) == -1) { streamID = open(file, O_RDWR | O_CREAT, 0666); if (streamID >= 0) { diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index a391ad5fc0b..36552c8b9db 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.44 2000/10/13 08:29:20 espie Exp $ */ +/* $OpenBSD: main.c,v 1.45 2000/11/24 14:36:34 espie Exp $ */ /* $NetBSD: main.c,v 1.34 1997/03/24 20:56:36 gwr Exp $ */ /* @@ -105,7 +105,7 @@ static char copyright[] = static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else UNUSED -static char rcsid[] = "$OpenBSD: main.c,v 1.44 2000/10/13 08:29:20 espie Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.45 2000/11/24 14:36:34 espie Exp $"; #endif #endif /* not lint */ @@ -117,7 +117,7 @@ static char rcsid[] = "$OpenBSD: main.c,v 1.44 2000/10/13 08:29:20 espie Exp $"; #define MAKEFLAGS ".MAKEFLAGS" LIST create; /* Targets to be made */ -time_t now = OUT_OF_DATE;/* Time at start of make */ +TIMESTAMP now; /* Time at start of make */ GNode *DEFAULT; /* .DEFAULT node */ Boolean allPrecious; /* .PRECIOUS given on line by itself */ @@ -530,6 +530,7 @@ main(argc, argv) /* avoid faults on read-only strings */ static char syspath[] = _PATH_DEFSYSPATH; + set_out_of_date(now); #ifdef RLIMIT_NOFILE /* * get rid of resource limit on file descriptors @@ -716,7 +717,7 @@ main(argc, argv) Suff_Init(); DEFAULT = NULL; - (void)time(&now); + grab(now); /* * Set up the .TARGETS variable to contain the list of targets to be diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c index 6f8e2c1d279..4d23caf28ec 100644 --- a/usr.bin/make/make.c +++ b/usr.bin/make/make.c @@ -1,4 +1,4 @@ -/* $OpenBSD: make.c,v 1.23 2000/09/14 13:52:42 espie Exp $ */ +/* $OpenBSD: make.c,v 1.24 2000/11/24 14:36:34 espie Exp $ */ /* $NetBSD: make.c,v 1.10 1996/11/06 17:59:15 christos Exp $ */ /* @@ -82,7 +82,7 @@ static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93"; #else UNUSED -static char rcsid[] = "$OpenBSD: make.c,v 1.23 2000/09/14 13:52:42 espie Exp $"; +static char rcsid[] = "$OpenBSD: make.c,v 1.24 2000/11/24 14:36:34 espie Exp $"; #endif #endif /* not lint */ @@ -107,9 +107,6 @@ static void MakePrintStatus __P((void *, void *)); * Set the cmtime field of a parent node based on the mtime stamp in its * child. Called from MakeOODate via Lst_ForEach. * - * Results: - * Always returns 0. - * * Side Effects: * The cmtime of the parent node will be changed if the mtime * field of the child is greater than it. @@ -120,10 +117,11 @@ Make_TimeStamp(pgn, cgn) GNode *pgn; /* the current parent */ GNode *cgn; /* the child we've just examined */ { - if (cgn->mtime > pgn->cmtime) + if (is_before(pgn->cmtime, cgn->mtime)) pgn->cmtime = cgn->mtime; } +/* Wrapper to call Make_TimeStamp from a forEach loop */ static void MakeTimeStamp(pgn, cgn) void *pgn; /* the current parent */ @@ -204,7 +202,7 @@ Make_OODate (gn) */ oodate = Arch_LibOODate (gn) || - (gn->cmtime == OUT_OF_DATE && (gn->type & OP_DOUBLEDEP)); + (is_out_of_date(gn->cmtime) && (gn->type & OP_DOUBLEDEP)); } else if (gn->type & OP_JOIN) { /* * A target with the .JOIN attribute is only considered @@ -229,9 +227,9 @@ Make_OODate (gn) } } oodate = TRUE; - } else if (gn->mtime < gn->cmtime || - (gn->cmtime == OUT_OF_DATE && - (gn->mtime == OUT_OF_DATE || (gn->type & OP_DOUBLEDEP)))) + } else if (is_before(gn->mtime, gn->cmtime) || + (is_out_of_date(gn->cmtime) && + (is_out_of_date(gn->mtime) || (gn->type & OP_DOUBLEDEP)))) { /* * A node whose modification time is less than that of its @@ -241,9 +239,9 @@ Make_OODate (gn) * it. */ if (DEBUG(MAKE)) { - if (gn->mtime < gn->cmtime) { + if (is_before(gn->mtime, gn->cmtime)) { printf("modified before source..."); - } else if (gn->mtime == OUT_OF_DATE) { + } else if (is_out_of_date(gn->mtime)) { printf("non-existent and no sources..."); } else { printf(":: operator and no sources..."); @@ -480,11 +478,11 @@ Make_Update (cgn) if ( ! (cgn->type & (OP_EXEC|OP_USE))) { if (cgn->made == MADE) { pgn->childMade = TRUE; - if (pgn->cmtime < cgn->mtime) { + if (is_before(pgn->cmtime, cgn->mtime)) { pgn->cmtime = cgn->mtime; } } else { - (void)Make_TimeStamp (pgn, cgn); + (void)Make_TimeStamp(pgn, cgn); } } if (pgn->unmade == 0) { @@ -572,8 +570,8 @@ MakeAddAllSrc(cgnp, pgnp) if (pgn->type & OP_JOIN) { if (cgn->made == MADE) Varq_Append(OODATE_INDEX, child, pgn); - } else if ((pgn->mtime < cgn->mtime) || - (cgn->mtime >= now && cgn->made == MADE)) + } else if (is_before(pgn->mtime, cgn->mtime) || + (!is_before(cgn->mtime, now) && cgn->made == MADE)) { /* * It goes in the OODATE variable if the parent is younger than the diff --git a/usr.bin/make/make.h b/usr.bin/make/make.h index 72c97b199a5..87b1f8cd5df 100644 --- a/usr.bin/make/make.h +++ b/usr.bin/make/make.h @@ -1,4 +1,4 @@ -/* $OpenBSD: make.h,v 1.28 2000/11/24 14:27:19 espie Exp $ */ +/* $OpenBSD: make.h,v 1.29 2000/11/24 14:36:35 espie Exp $ */ /* $NetBSD: make.h,v 1.15 1997/03/10 21:20:00 christos Exp $ */ /* @@ -90,6 +90,34 @@ #include "config.h" #include "buf.h" +#ifdef USE_TIMESPEC +#include <sys/time.h> +typedef struct timespec TIMESTAMP; +#define set_out_of_date(t) (t).tv_sec = INT_MIN, (t).tv_nsec = 0 +#define is_out_of_date(t) ((t).tv_sec == INT_MIN && (t).tv_nsec == 0) +#define grab_stat(s, t) \ +do { \ + (t).tv_sec = (s).st_mtime; \ + (t).tv_nsec = (s).st_mtimensec; \ + if (is_out_of_date(t)) \ + (t).tv_nsec++; \ +} while (0) +#define is_before(t1, t2) timespeccmp(&(t1), &(t2), <) +#define grab_date(d, t) \ +do { \ + (t).tv_sec = d; \ + (t).tv_nsec = 0; \ + if (is_out_of_date(t)) \ + (t).tv_nsec++; \ +} while (0) +#define grab(n) \ +do { \ + struct timeval tv; \ + gettimeofday(&tv, NULL); \ + TIMEVAL_TO_TIMESPEC(&(tv), &n); \ +} while (0) +#define timestamp2time_t(t) ((t).tv_sec) +#else typedef time_t TIMESTAMP; #define is_out_of_date(t) ((t) == INT_MIN) #define set_out_of_date(t) (t) = INT_MIN @@ -108,8 +136,7 @@ do { \ } while (0) #define grab(n) time(&(n)) #define timestamp2time_t(t) (t) - -#define OUT_OF_DATE INT_MIN +#endif /* Variables that are kept in local GNodes. */ #define TARGET_INDEX 0 @@ -191,8 +218,8 @@ typedef struct GNode_ { * made */ int unmade; /* The number of unmade children */ - time_t mtime; /* Its modification time */ - time_t cmtime; /* The modification time of its youngest + TIMESTAMP mtime; /* Its modification time */ + TIMESTAMP cmtime; /* The modification time of its youngest * child */ LIST iParents; /* Links to parents for which this is an @@ -395,7 +422,7 @@ extern char var_Error[]; /* Value returned by Var_Parse when an error * an empty string, so naive callers needn't * worry about it. */ -extern time_t now; /* The time at the start of this whole +extern TIMESTAMP now; /* The time at the start of this whole * process */ extern Boolean oldVars; /* Do old-style variable substitution */ diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c index 35386ab521b..1d739ddcd09 100644 --- a/usr.bin/make/targ.c +++ b/usr.bin/make/targ.c @@ -1,4 +1,4 @@ -/* $OpenBSD: targ.c,v 1.28 2000/09/14 13:52:42 espie Exp $ */ +/* $OpenBSD: targ.c,v 1.29 2000/11/24 14:36:35 espie Exp $ */ /* $NetBSD: targ.c,v 1.11 1997/02/20 16:51:50 christos Exp $ */ /* @@ -87,7 +87,7 @@ static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94"; #else UNUSED -static char *rcsid = "$OpenBSD: targ.c,v 1.28 2000/09/14 13:52:42 espie Exp $"; +static char *rcsid = "$OpenBSD: targ.c,v 1.29 2000/11/24 14:36:35 espie Exp $"; #endif #endif /* not lint */ @@ -175,7 +175,8 @@ Targ_NewGN(name, end) gn->made = UNMADE; gn->childMade = FALSE; gn->order = 0; - gn->mtime = gn->cmtime = OUT_OF_DATE; + set_out_of_date(gn->mtime); + set_out_of_date(gn->cmtime); Lst_Init(&gn->iParents); Lst_Init(&gn->cohorts); Lst_Init(&gn->parents); @@ -401,12 +402,15 @@ Targ_PrintCmd(cmd) */ char * Targ_FmtTime(time) - time_t time; + TIMESTAMP time; { struct tm *parts; static char buf[128]; + time_t t; - parts = localtime(&time); + t = timestamp2time_t(time); + + parts = localtime(&t); strftime(buf, sizeof buf, "%k:%M:%S %b %d, %Y", parts); buf[sizeof(buf) - 1] = '\0'; return(buf); @@ -479,7 +483,7 @@ TargPrintNode(gn, pass) else printf("# No unmade children\n"); if (! (gn->type & (OP_JOIN|OP_USE|OP_EXEC))) { - if (gn->mtime != OUT_OF_DATE) + if (!is_out_of_date(gn->mtime)) printf("# last modified %s: %s\n", Targ_FmtTime(gn->mtime), (gn->made == UNMADE ? "unmade" : |