#include <assert.h>
#include <ctype.h>
#include <errno.h>
-#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
time_for_ttx(void)
{
struct tm *timeptr, tm;
- uintmax_t epochumax;
+ unsigned long long epochull;
char *epochstr, *endptr, *timestr;
/* Work out what timestamp to use. */
if ((epochstr = getenv("SOURCE_DATE_EPOCH")) != NULL) {
errno = 0;
- epochumax = strtoumax(epochstr, &endptr, 10);
+ epochull = strtoull(epochstr, &endptr, 10);
if (!isdigit((unsigned char)epochstr[0]) ||
endptr == epochstr || *endptr != '\0' ||
errno == ERANGE ||
/* Allow years up to 9999. */
- epochumax >= 253402300800) {
+ epochull >= 253402300800) {
fprintf(stderr, "Invalid SOURCE_DATE_EPOCH\n");
return NULL;
}
tm.tm_isdst = -1;
- tm.tm_sec = epochumax % 60;
- tm.tm_min = epochumax / 60 % 60;
- tm.tm_hour = epochumax / 3600 % 24;
- long day = epochumax / 86400;
+ tm.tm_sec = epochull % 60;
+ tm.tm_min = epochull / 60 % 60;
+ tm.tm_hour = epochull / 3600 % 24;
+ long day = epochull / 86400;
tm.tm_wday = (day + 4) % 7; /* 1970-01-01 was a Thursday. */
int y = 1970 + (day / 146097) * 400;
day = day % 146097;