diff options
Diffstat (limited to 'Build/source/texk/web2c/lib/texmfmp.c')
-rw-r--r-- | Build/source/texk/web2c/lib/texmfmp.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c index 90965456cf6..c56cd026a99 100644 --- a/Build/source/texk/web2c/lib/texmfmp.c +++ b/Build/source/texk/web2c/lib/texmfmp.c @@ -2213,6 +2213,7 @@ void init_start_time() { char *endptr; if (!start_time_set) { start_time_set = true; +#ifndef onlyTeX source_date_epoch = getenv("SOURCE_DATE_EPOCH"); if (source_date_epoch) { errno = 0; @@ -2222,7 +2223,9 @@ FATAL1 ("invalid epoch-seconds-timezone value for environment variable $SOURCE_D source_date_epoch); } start_time = epoch; - } else { + } else +#endif /* not onlyTeX */ + { start_time = time((time_t *) NULL); } } @@ -2239,22 +2242,27 @@ get_date_and_time (integer *minutes, integer *day, integer *month, integer *year) { struct tm *tmptr; +#ifndef onlyTeX string sde_texprim = getenv ("SOURCE_DATE_EPOCH_TEX_PRIMITIVES"); if (sde_texprim && STREQ (sde_texprim, "1")) { init_start_time (); tmptr = gmtime (&start_time); - } else { + } else +#endif /* not onlyTeX */ + { /* whether the envvar was not set (usual case) or invalid, use current time. */ time_t myclock = time ((time_t *) 0); tmptr = localtime (&myclock); +#ifndef onlyTeX /* warn if they gave an invalid value, empty (null string) ok. */ if (sde_texprim && strlen (sde_texprim) > 0 && !STREQ (sde_texprim, "0")) { WARNING1 ("invalid value (expected 0 or 1) for environment variable $SOURCE_DATE_EPOCH_TEX_PRIMITIVES: %s", sde_texprim); } +#endif /* not onlyTeX */ } *minutes = tmptr->tm_hour * 60 + tmptr->tm_min; |