Honour an external definition of SOURCE_DATE_EPOCH when updating the embedded modification date in TTF/TTC files. --- a/lib/tatime.c +++ b/lib/tatime.c @@ -15,6 +15,8 @@ #include #include +#include +#include #include "ta.h" @@ -27,12 +29,51 @@ TA_get_current_time(FT_ULong* high, { /* there have been 24107 days between January 1st, 1904 (the epoch of */ /* OpenType), and January 1st, 1970 (the epoch of the `time' function) */ - TA_ULongLong seconds_to_1970 = 24107 * 24 * 60 * 60; - TA_ULongLong seconds_to_today = seconds_to_1970 + (TA_ULongLong)time(NULL); + const TA_ULongLong seconds_to_1970 = 24107 * 24 * 60 * 60; + TA_ULongLong seconds_to_build; + time_t now; + char *source_date_epoch, *endptr; + TA_ULongLong epoch; + source_date_epoch = getenv("SOURCE_DATE_EPOCH"); + if (source_date_epoch) { + errno = 0; + epoch = strtoull(source_date_epoch, &endptr, 10); + if ((errno == ERANGE && (epoch ==
aboutsummaryrefslogtreecommitdiff
path: root/