From 6c95f03dbe22357828df688bc272f893afff4492 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 17 Dec 2008 00:02:40 +0100 Subject: parse-duration: various small improvements. --- lib/parse-duration.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib/parse-duration.h') diff --git a/lib/parse-duration.h b/lib/parse-duration.h index 7ecc7dbe0b..fbc732ff39 100644 --- a/lib/parse-duration.h +++ b/lib/parse-duration.h @@ -47,9 +47,11 @@ yy Y mm M ww W dd D or it may be empty and followed by a 'T'. The "yyyymmdd" must be eight - digits long. Note: months are always 30 days and years are always 365 - days long. 5 years is always 1825, not 1826 or 1827 depending on leap - year considerations. 3 months is always 90 days. There is no consideration + digits long. + + NOTE! Months are always 30 days and years are always 365 days long. + 5 years is always 1825 days, not 1826 or 1827 depending on leap year + considerations. 3 months is always 90 days. There is no consideration for how many days are in the current, next or previous months. For the final format: @@ -75,8 +77,12 @@ #include +/* Return value when a valid duration cannot be parsed. */ #define BAD_TIME ((time_t)~0) +/* Parses the given string. If it has the syntax of a valid duration, + this duration is returned. Otherwise, the return value is BAD_TIME, + and errno is set to either EINVAL (bad syntax) or ERANGE (out of range). */ extern time_t parse_duration(char const * in_pz); #endif /* GNULIB_PARSE_DURATION_H */ -- cgit v1.2.1