summaryrefslogtreecommitdiff
path: root/lib/parse-duration.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2008-12-17 00:02:40 +0100
committerBruno Haible <bruno@clisp.org>2008-12-17 00:02:40 +0100
commit6c95f03dbe22357828df688bc272f893afff4492 (patch)
tree4ef3e90b05abcaf00c04e0833918dc7cfe2634a5 /lib/parse-duration.h
parent43a17127d54676bf718bd37e2d72e5d9e498b1d8 (diff)
downloadgnulib-6c95f03dbe22357828df688bc272f893afff4492.tar.gz
parse-duration: various small improvements.
Diffstat (limited to 'lib/parse-duration.h')
-rw-r--r--lib/parse-duration.h12
1 files changed, 9 insertions, 3 deletions
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 <time.h>
+/* 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 */