SOURCE_DATE_EPOCH support

Norbert Preining norbert at preining.info
Mon Jun 29 00:35:41 CEST 2020


Hi Werner,

> do Metafont and Metapost support the `SOURCE_DATE_EPOCH` environment
> variable?

---
 texk/web2c/mplibdir/mp.w |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- texlive-bin.orig/texk/web2c/mplibdir/mp.w
+++ texlive-bin/texk/web2c/mplibdir/mp.w
@@ -4380,7 +4380,11 @@ be used after the year 32767.

 @c
 static void mp_fix_date_and_time (MP mp) {
-  time_t aclock = time ((time_t *) 0);
+  time_t aclock;
+  char *source_date_epoch;
+  if ((source_date_epoch = getenv("SOURCE_DATE_EPOCH")) == NULL ||
+      (aclock = (time_t) strtoll(source_date_epoch, NULL, 10)) <= 0)
+    aclock = time ((time_t *) 0);
   struct tm *tmptr = localtime (&aclock);
   set_internal_from_number (mp_time, unity_t);
   number_multiply_int (internal_value(mp_time), (tmptr->tm_hour * 60 + tmptr->tm_min));


At least for metapost ;-)

Norbert

--
PREINING Norbert                              https://www.preining.info
Accelia Inc. + IFMGA ProGuide + TU Wien + JAIST + TeX Live + Debian Dev
GPG: 0x860CDC13   fp: F7D8 A928 26E3 16A1 9FA0 ACF0 6CAC A448 860C DC13


More information about the tex-live mailing list.