texlive[56033] Build/source/texk/web2c/mplibdir/mp.w: mplibdir: sync

commits+kakuto at tug.org commits+kakuto at tug.org
Mon Aug 3 06:27:15 CEST 2020


Revision: 56033
          http://tug.org/svn/texlive?view=revision&revision=56033
Author:   kakuto
Date:     2020-08-03 06:27:14 +0200 (Mon, 03 Aug 2020)
Log Message:
-----------
mplibdir: sync with upstream

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/mplibdir/mp.w

Modified: trunk/Build/source/texk/web2c/mplibdir/mp.w
===================================================================
--- trunk/Build/source/texk/web2c/mplibdir/mp.w	2020-08-02 23:53:34 UTC (rev 56032)
+++ trunk/Build/source/texk/web2c/mplibdir/mp.w	2020-08-03 04:27:14 UTC (rev 56033)
@@ -4379,9 +4379,32 @@
 be used after the year 32767.
 
 @c
+#if defined(_MSC_VER)
+#define strtoull _strtoui64
+#endif
 static void mp_fix_date_and_time (MP mp) {
-  time_t aclock = time ((time_t *) 0);
-  struct tm *tmptr = localtime (&aclock);
+  char *source_date_epoch;
+  time_t epoch;
+  char *endptr;
+  struct tm *tmptr;
+  source_date_epoch = getenv("SOURCE_DATE_EPOCH");
+  if (source_date_epoch) {
+    errno = 0;
+    epoch = strtoull(source_date_epoch, &endptr, 10);
+    if (*endptr != '\0' || errno != 0) {
+      FATAL1("invalid epoch-seconds-timezone value for environment variable $SOURCE_DATE_EPOCH: %s",
+              source_date_epoch);
+    }
+/* there is a limit 3001.01.01:2059 for epoch in Microsoft C */
+#if defined(_MSC_VER)
+    if (epoch > 32535291599ULL)
+      epoch = 32535291599ULL;
+#endif
+    tmptr = gmtime (&epoch);
+  } else {
+    epoch = time ((time_t *) 0);
+    tmptr = localtime (&epoch);
+  }
   set_internal_from_number (mp_time, unity_t);
   number_multiply_int (internal_value(mp_time), (tmptr->tm_hour * 60 + tmptr->tm_min));
   set_internal_from_number (mp_hour, unity_t);



More information about the tex-live-commits mailing list.