From afa7c4a28feaac74b7d64b22c61a73377a9c0f2a Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 11 Jun 2014 15:43:37 -0700 Subject: [PATCH] parse-duration: eliminate 31/31-bit time_t limitation * lib/parse-duration.c: Include "intprops.h". (TIME_MAX): Define to TYPE_MAXIMUM (time_t), thus eliminating a limitation that the result duration could not exceed 68 years. * modules/parse-duration (Depends-on): Add intprops. Reported by Jonas 'Sortie' Termansen. --- ChangeLog | 10 ++++++++++ lib/parse-duration.c | 3 ++- modules/parse-duration | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 53be01f..f34b3fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2014-06-11 Jim Meyering + + parse-duration: eliminate 31/31-bit time_t limitation + * lib/parse-duration.c: Include "intprops.h". + (TIME_MAX): Define to TYPE_MAXIMUM (time_t), thus + eliminating a limitation that the result duration could + not exceed 68 years. + * modules/parse-duration (Depends-on): Add intprops. + Reported by Jonas 'Sortie' Termansen. + 2014-06-07 Paul Eggert maint: fix typo in fdl.texi diff --git a/lib/parse-duration.c b/lib/parse-duration.c index 037e81e..8c7d9d7 100644 --- a/lib/parse-duration.c +++ b/lib/parse-duration.c @@ -26,6 +26,7 @@ #include #include #include +#include "intprops.h" #ifndef NUL #define NUL '\0' @@ -51,7 +52,7 @@ typedef enum { #define SEC_PER_MONTH (SEC_PER_DAY * 30) #define SEC_PER_YEAR (SEC_PER_DAY * 365) -#define TIME_MAX 0x7FFFFFFF +#define TIME_MAX TYPE_MAXIMUM (time_t) /* Wrapper around strtoul that does not require a cast. */ static unsigned long diff --git a/modules/parse-duration b/modules/parse-duration index 46288c0..6184dc4 100644 --- a/modules/parse-duration +++ b/modules/parse-duration @@ -6,6 +6,7 @@ lib/parse-duration.h lib/parse-duration.c Depends-on: +intprops configure.ac: -- 2.0.0.254.g50f84e3