diff --git a/MagickCore/string-private.h b/MagickCore/string-private.h index 40bdb2dcc8..d44afbf736 100644 --- a/MagickCore/string-private.h +++ b/MagickCore/string-private.h @@ -114,6 +114,18 @@ static inline long StringToLong(const char *magick_restrict value) return(strtol(value,(char **) NULL,10)); } +static inline MagickOffsetType StringToMagickOffsetType(const char *string, + const double interval) +{ + double + value; + + value=SiPrefixToDoubleInterval(string,interval); + if (value >= (double) MagickULLConstant(~0)) + return((MagickOffsetType) MagickULLConstant(~0)); + return((MagickOffsetType) value); +} + static inline MagickSizeType StringToMagickSizeType(const char *string, const double interval) { diff --git a/MagickCore/timer.c b/MagickCore/timer.c index 7ed577a6aa..59aad7d643 100644 --- a/MagickCore/timer.c +++ b/MagickCore/timer.c @@ -360,17 +360,17 @@ MagickExport time_t GetMagickTime(void) const char *source_date_epoch; - epoch_initialized=MagickTrue; source_date_epoch=getenv("SOURCE_DATE_EPOCH"); if (source_date_epoch != (const char *) NULL) { time_t epoch; - epoch=(time_t) StringToUnsignedLong(source_date_epoch); + epoch=(time_t) StringToMagickOffsetType(source_date_epoch,100.0); if ((epoch > 0) && (epoch <= time((time_t *) NULL))) magick_epoch=epoch; } + epoch_initialized=MagickTrue; } if (magick_epoch != 0) return(magick_epoch);