Commit Graph

21 Commits

Author SHA1 Message Date
Jim Meyering
035abbb7c6 (posixtime) [lint]: Initialize *all* of tm0, not just
the .tm_year member, since otherwise gcc-4.0 would now warn about
tm_zone, tm_gmtoff, tm_isdst, tm_yday, tm_wday.
2005-07-03 21:10:31 +00:00
Jim Meyering
116e6fb244 Update FSF postal mail address. 2005-05-14 07:58:06 +00:00
Jim Meyering
5fb6300448 (posixtime) [lint]: Avoid spurious warning from gcc-4's
-Wuninitialized: initialize tm0.tm_year.
2005-04-09 13:28:25 +00:00
Paul Eggert
1cc46fbf53 Sync from gnulib, to remove dependencies of other modules on unlocked-io. 2004-10-04 20:18:43 +00:00
Paul Eggert
e71e29e309 (posix_time_parse): Don't assume that the length of
the string being parsed is <= UINT_MAX.
2004-08-02 20:34:27 +00:00
Jim Meyering
1512acb7e5 Include <stdlib.h>, <string.h> unconditionally.
(main): Define with a prototype.
2003-09-10 09:07:17 +00:00
Jim Meyering
6d1208ecf2 Include <stdbool.h> unconditionally. 2003-06-06 19:18:54 +00:00
Jim Meyering
c66dd95e8e Fix some minor time-related bugs with POSIX time arguments.
Some valid time stamps were being rejected (notably -1, and
time stamps before 1900 on 64-bit hosts).  And some invalid
time stamps were being accepted, e.g. September 31.

* lib/posixtm.h (posixtime): Return bool instead of time_t, so
that we can return (time_t) -1 successfully.
* lib/posixtm.c: Likewise.
[HAVE_STDBOOL_H]: Include <stdbool.h>.
(bool, false, true) [!HAVE_STDBOOL_H]: New type.
(t): Remove static var.
(year, posix_time_parse): Now takes struct tm * arg to modify, instead
of static var.  All uses changed.
(year): Do not reject years before 1900; they can occur with
64-bit time_t.
(posix_time_parse): Do not check for out-of-range components;
that is now the caller's responsibility, since our checks were
only approximations.
(posixtime): Use mktime to check for out-of-range components,
since it knows them exactly.
If mktime returns (time_t) -1, check whether an error actually occurred
by invoking localtime on -1.
(main) [TEST_POSIXTIME]: Check for input data errors, and report
posixtime failures better.
Improve the test data (in comments only).
2002-08-07 22:02:23 +00:00
Jim Meyering
fe734b9b2d (ISDIGIT): Comment fix. 2002-01-16 22:37:35 +00:00
Jim Meyering
0b072ba82c (posix_time_parse): Add cast to avoid warning about
`signed and unsigned type in conditional expression'.
2001-12-09 22:56:16 +00:00
Jim Meyering
3eb2a22131 Include unlocked-io.h. 2001-11-17 13:29:42 +00:00
Jim Meyering
204a9ee115 [HAVE_STDLIB_H]: Include stdlib.h. 2000-06-26 10:55:18 +00:00
Jim Meyering
0f2fbadbea (posix_time_parse): Change type of index `i' from int to unsigned int. 1998-12-31 14:53:16 +00:00
Jim Meyering
2e4ebbf522 *** empty log message *** 1998-10-02 14:31:24 +00:00
Jim Meyering
84fd56fe2a *** empty log message *** 1998-10-02 14:31:11 +00:00
Jim Meyering
9ce9d75ddb add test harness 1998-09-07 03:23:30 +00:00
Jim Meyering
d59ce5651c *** empty log message *** 1998-09-07 02:38:28 +00:00
Jim Meyering
981c203fab *** empty log message *** 1998-09-07 02:36:36 +00:00
Jim Meyering
c0ad97a781 rewrite from yacc-based version 1998-09-06 22:57:00 +00:00
Jim Meyering
c5a9a5f563 . 1998-09-06 22:55:47 +00:00
Jim Meyering
0683ef74d1 Initial revision 1994-11-06 17:40:20 +00:00