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
..
2000-08-26 12:04:46 +00:00
2000-08-28 14:55:18 +00:00
2000-11-03 08:44:12 +00:00
2001-07-15 15:13:14 +00:00
2000-10-22 13:03:06 +00:00
2002-02-26 15:38:49 +00:00
2002-02-26 15:38:49 +00:00
2001-08-13 06:30:10 +00:00
2001-08-30 19:19:02 +00:00
2001-11-17 13:29:42 +00:00
2001-11-03 21:46:29 +00:00
2000-05-06 14:33:46 +00:00
2002-01-16 22:44:43 +00:00
2000-08-07 15:48:18 +00:00
2001-05-12 15:39:45 +00:00
2000-08-07 17:03:20 +00:00
2002-07-01 14:19:20 +00:00
2002-06-22 09:03:14 +00:00
2000-06-21 13:00:49 +00:00
2002-07-27 21:39:33 +00:00
2000-08-07 15:48:18 +00:00
2001-12-20 10:01:25 +00:00
2000-12-02 20:45:30 +00:00
2002-02-16 14:10:17 +00:00
2000-07-29 17:06:00 +00:00
2000-08-07 15:48:18 +00:00
2001-11-03 18:50:53 +00:00
2002-04-12 21:03:28 +00:00
2001-05-21 06:36:36 +00:00
2001-05-12 15:46:36 +00:00
2000-08-07 15:48:18 +00:00
2001-03-03 19:05:36 +00:00
2001-11-17 13:29:42 +00:00
2001-08-04 17:52:38 +00:00
2001-11-17 13:29:42 +00:00
2001-08-31 06:34:06 +00:00
2002-06-22 09:25:36 +00:00
2002-06-22 09:25:36 +00:00
2001-11-17 13:29:42 +00:00
2000-04-30 16:25:24 +00:00
2002-06-14 07:52:32 +00:00
2002-06-19 11:12:59 +00:00
2000-08-07 15:48:18 +00:00
2000-04-15 21:54:46 +00:00
2002-06-22 08:55:43 +00:00
2002-06-26 06:17:35 +00:00
2002-06-26 06:17:35 +00:00
2001-03-03 19:05:36 +00:00
2000-08-07 15:48:18 +00:00
2000-08-07 15:48:18 +00:00
2001-08-31 07:29:05 +00:00
2001-08-31 07:34:41 +00:00
2001-09-26 08:27:42 +00:00
2000-08-07 15:48:18 +00:00
2002-01-16 22:43:41 +00:00
2000-08-07 15:48:18 +00:00
2000-08-07 15:48:18 +00:00
2000-06-21 09:56:42 +00:00
2000-10-31 07:09:02 +00:00
2000-06-19 07:25:01 +00:00
2001-08-12 13:02:20 +00:00
2001-10-21 10:55:29 +00:00
2001-08-12 13:02:20 +00:00
2000-04-18 13:41:26 +00:00
2001-11-17 13:29:42 +00:00
2001-12-09 22:08:19 +00:00
2000-06-21 09:09:57 +00:00
2002-07-20 06:31:12 +00:00
2002-03-01 23:54:52 +00:00
2002-05-27 16:42:55 +00:00
2000-06-04 06:47:31 +00:00
2001-11-17 13:29:42 +00:00
2000-07-09 07:22:43 +00:00
2000-08-07 15:48:18 +00:00
2002-04-30 09:17:50 +00:00
2001-10-05 11:44:30 +00:00
2001-10-05 11:44:30 +00:00
2001-11-23 08:09:14 +00:00
2001-11-23 08:09:31 +00:00
2001-12-19 15:05:33 +00:00
2000-08-07 15:48:18 +00:00
2002-06-15 07:36:57 +00:00
2001-12-10 00:13:36 +00:00
2000-08-07 15:48:18 +00:00
2002-02-16 14:10:17 +00:00
2000-06-29 11:24:09 +00:00
2000-08-07 15:48:18 +00:00
2002-06-22 09:26:57 +00:00
2002-07-28 21:45:04 +00:00
2002-03-10 22:15:53 +00:00
2000-11-05 15:04:39 +00:00
2000-08-07 15:48:18 +00:00
2001-08-04 17:07:37 +00:00
2001-08-04 17:06:05 +00:00
2001-11-17 13:29:42 +00:00
2000-11-27 09:33:53 +00:00
2000-10-28 08:22:11 +00:00
2000-10-28 08:24:44 +00:00
2002-01-22 07:56:44 +00:00
2000-12-02 09:58:31 +00:00
2000-08-07 15:48:18 +00:00
2001-09-16 12:42:14 +00:00
2001-11-17 10:59:01 +00:00
2000-08-07 15:48:18 +00:00
2001-12-09 22:54:19 +00:00
2000-08-07 15:48:18 +00:00
2002-07-15 13:00:40 +00:00
2002-07-09 08:40:15 +00:00
2002-03-01 23:19:28 +00:00
2001-10-21 09:01:24 +00:00
2000-11-18 09:53:33 +00:00
2002-02-23 09:02:18 +00:00
2001-08-12 18:49:13 +00:00
2001-11-16 09:20:25 +00:00
2000-12-19 08:22:18 +00:00
2002-08-07 22:02:23 +00:00
2002-02-16 08:13:08 +00:00
2002-02-16 08:13:08 +00:00
2000-04-07 09:24:18 +00:00
2001-01-26 11:15:37 +00:00
2000-10-17 08:45:07 +00:00
2002-01-22 08:02:22 +00:00
2002-01-22 08:02:43 +00:00
2000-04-18 17:28:34 +00:00
2001-12-09 22:39:02 +00:00
2001-11-17 13:29:42 +00:00
2002-07-27 21:35:39 +00:00
2000-08-07 15:48:18 +00:00
2000-04-04 12:50:44 +00:00
2000-04-04 12:50:59 +00:00
2001-12-08 06:57:58 +00:00
2001-12-15 16:57:15 +00:00
2002-03-08 08:23:47 +00:00
2000-08-07 15:48:18 +00:00
2000-04-28 16:49:38 +00:00
2000-08-07 15:48:18 +00:00
2001-05-12 15:48:00 +00:00
2000-10-22 06:57:42 +00:00
2001-08-31 09:09:53 +00:00
2001-08-31 09:09:35 +00:00
2000-07-09 07:22:43 +00:00
2002-03-01 23:20:20 +00:00
2001-11-17 13:29:42 +00:00
2000-09-20 08:06:06 +00:00
2002-04-29 07:00:23 +00:00
2002-04-29 06:59:24 +00:00
2001-03-03 19:05:36 +00:00
2000-08-07 15:48:18 +00:00
2000-08-07 15:48:18 +00:00
2000-08-07 15:48:18 +00:00
2000-08-07 15:48:18 +00:00
2000-08-07 15:48:18 +00:00
2001-12-09 21:02:43 +00:00
2001-05-12 15:50:27 +00:00
2000-07-04 17:37:43 +00:00
2002-03-02 17:39:17 +00:00
2000-11-17 08:19:01 +00:00
2000-08-07 15:48:18 +00:00
2001-09-17 10:24:20 +00:00
2000-08-07 15:48:18 +00:00
2001-08-26 07:28:06 +00:00
2001-02-17 16:56:20 +00:00
2000-08-07 15:48:18 +00:00
2001-08-31 09:39:10 +00:00
2002-01-16 22:38:26 +00:00
2001-12-02 19:59:39 +00:00
2002-03-01 23:16:55 +00:00
2002-02-11 14:28:09 +00:00
2002-02-11 14:28:35 +00:00
2001-03-03 19:05:36 +00:00
2002-01-16 22:38:04 +00:00
2001-08-31 07:35:47 +00:00
2002-01-05 21:13:29 +00:00
2000-08-07 15:48:18 +00:00
2000-10-31 07:09:56 +00:00
2001-09-04 20:28:31 +00:00
2001-12-09 21:01:15 +00:00
2002-07-20 07:07:48 +00:00
2002-01-22 08:02:55 +00:00
2002-01-22 08:02:55 +00:00
2001-12-09 22:46:53 +00:00
2001-09-04 20:21:54 +00:00
2002-07-15 12:59:47 +00:00
2001-11-30 14:32:22 +00:00
2001-08-26 07:03:07 +00:00
2001-12-19 10:41:27 +00:00
2001-08-31 08:15:10 +00:00
2000-08-07 15:48:18 +00:00
2001-11-17 13:29:42 +00:00