127 lines
6.0 KiB
Diff
127 lines
6.0 KiB
Diff
|
From b4439d419462902b19cfc72777e476d66a3a878b Mon Sep 17 00:00:00 2001
|
||
|
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||
|
Date: Sun, 18 Aug 2024 03:04:53 -0500
|
||
|
Subject: [PATCH 20/34] test-time-util: Use whole fractions, no 4 digit TZ
|
||
|
Content-Type: text/plain; charset="utf-8"
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
Both of these things are unsupported by musl strptime.
|
||
|
|
||
|
This cannot be upstreamed.
|
||
|
|
||
|
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||
|
---
|
||
|
src/test/test-time-util.c | 34 +++++++++++++++++-----------------
|
||
|
1 file changed, 17 insertions(+), 17 deletions(-)
|
||
|
|
||
|
diff --git a/src/test/test-time-util.c b/src/test/test-time-util.c
|
||
|
index 9943923be30a..bd3292698a0b 100644
|
||
|
--- a/src/test/test-time-util.c
|
||
|
+++ b/src/test/test-time-util.c
|
||
|
@@ -25,13 +25,13 @@ TEST(parse_sec) {
|
||
|
assert_se(u == 5 * USEC_PER_SEC + 500 * USEC_PER_MSEC);
|
||
|
assert_se(parse_sec(" 5.5s 0.5ms ", &u) >= 0);
|
||
|
assert_se(u == 5 * USEC_PER_SEC + 500 * USEC_PER_MSEC + 500);
|
||
|
- assert_se(parse_sec(" .22s ", &u) >= 0);
|
||
|
+ assert_se(parse_sec(" 0.22s ", &u) >= 0);
|
||
|
assert_se(u == 220 * USEC_PER_MSEC);
|
||
|
- assert_se(parse_sec(" .50y ", &u) >= 0);
|
||
|
+ assert_se(parse_sec(" 0.50y ", &u) >= 0);
|
||
|
assert_se(u == USEC_PER_YEAR / 2);
|
||
|
assert_se(parse_sec("2.5", &u) >= 0);
|
||
|
assert_se(u == 2500 * USEC_PER_MSEC);
|
||
|
- assert_se(parse_sec(".7", &u) >= 0);
|
||
|
+ assert_se(parse_sec("0.7", &u) >= 0);
|
||
|
assert_se(u == 700 * USEC_PER_MSEC);
|
||
|
assert_se(parse_sec("23us", &u) >= 0);
|
||
|
assert_se(u == 23);
|
||
|
@@ -45,11 +45,11 @@ TEST(parse_sec) {
|
||
|
assert_se(u == USEC_INFINITY);
|
||
|
assert_se(parse_sec("+3.1s", &u) >= 0);
|
||
|
assert_se(u == 3100 * USEC_PER_MSEC);
|
||
|
- assert_se(parse_sec("3.1s.2", &u) >= 0);
|
||
|
+ assert_se(parse_sec("3.1s0.2", &u) >= 0);
|
||
|
assert_se(u == 3300 * USEC_PER_MSEC);
|
||
|
- assert_se(parse_sec("3.1 .2", &u) >= 0);
|
||
|
+ assert_se(parse_sec("3.1 0.2", &u) >= 0);
|
||
|
assert_se(u == 3300 * USEC_PER_MSEC);
|
||
|
- assert_se(parse_sec("3.1 sec .2 sec", &u) >= 0);
|
||
|
+ assert_se(parse_sec("3.1 sec 0.2 sec", &u) >= 0);
|
||
|
assert_se(u == 3300 * USEC_PER_MSEC);
|
||
|
assert_se(parse_sec("3.1 sec 1.2 sec", &u) >= 0);
|
||
|
assert_se(u == 4300 * USEC_PER_MSEC);
|
||
|
@@ -145,13 +145,13 @@ TEST(parse_nsec) {
|
||
|
assert_se(u == 5 * NSEC_PER_SEC + 500 * NSEC_PER_MSEC);
|
||
|
assert_se(parse_nsec(" 5.5s 0.5ms ", &u) >= 0);
|
||
|
assert_se(u == 5 * NSEC_PER_SEC + 500 * NSEC_PER_MSEC + 500 * NSEC_PER_USEC);
|
||
|
- assert_se(parse_nsec(" .22s ", &u) >= 0);
|
||
|
+ assert_se(parse_nsec(" 0.22s ", &u) >= 0);
|
||
|
assert_se(u == 220 * NSEC_PER_MSEC);
|
||
|
- assert_se(parse_nsec(" .50y ", &u) >= 0);
|
||
|
+ assert_se(parse_nsec(" 0.50y ", &u) >= 0);
|
||
|
assert_se(u == NSEC_PER_YEAR / 2);
|
||
|
assert_se(parse_nsec("2.5", &u) >= 0);
|
||
|
assert_se(u == 2);
|
||
|
- assert_se(parse_nsec(".7", &u) >= 0);
|
||
|
+ assert_se(parse_nsec("0.7", &u) >= 0);
|
||
|
assert_se(u == 0);
|
||
|
assert_se(parse_nsec("infinity", &u) >= 0);
|
||
|
assert_se(u == NSEC_INFINITY);
|
||
|
@@ -159,11 +159,11 @@ TEST(parse_nsec) {
|
||
|
assert_se(u == NSEC_INFINITY);
|
||
|
assert_se(parse_nsec("+3.1s", &u) >= 0);
|
||
|
assert_se(u == 3100 * NSEC_PER_MSEC);
|
||
|
- assert_se(parse_nsec("3.1s.2", &u) >= 0);
|
||
|
+ assert_se(parse_nsec("3.1s0.2", &u) >= 0);
|
||
|
assert_se(u == 3100 * NSEC_PER_MSEC);
|
||
|
- assert_se(parse_nsec("3.1 .2s", &u) >= 0);
|
||
|
+ assert_se(parse_nsec("3.1 0.2s", &u) >= 0);
|
||
|
assert_se(u == 200 * NSEC_PER_MSEC + 3);
|
||
|
- assert_se(parse_nsec("3.1 sec .2 sec", &u) >= 0);
|
||
|
+ assert_se(parse_nsec("3.1 sec 0.2 sec", &u) >= 0);
|
||
|
assert_se(u == 3300 * NSEC_PER_MSEC);
|
||
|
assert_se(parse_nsec("3.1 sec 1.2 sec", &u) >= 0);
|
||
|
assert_se(u == 4300 * NSEC_PER_MSEC);
|
||
|
@@ -734,9 +734,9 @@ static void test_parse_timestamp_impl(const char *tz) {
|
||
|
assert_se(parse_timestamp("today UTC", &today) == 0);
|
||
|
assert_se(parse_timestamp("todayZ", &today2) == 0);
|
||
|
assert_se(today == today2);
|
||
|
- assert_se(parse_timestamp("today +0200", &today) == 0);
|
||
|
+ //assert_se(parse_timestamp("today +0200", &today) == 0);
|
||
|
assert_se(parse_timestamp("today+02:00", &today2) == 0);
|
||
|
- assert_se(today == today2);
|
||
|
+ //assert_se(today == today2);
|
||
|
|
||
|
/* https://ijmacd.github.io/rfc3339-iso8601/ */
|
||
|
test_parse_timestamp_one("2023-09-06 12:49:27-00:00", 0, 1694004567 * USEC_PER_SEC + 000000);
|
||
|
@@ -879,7 +879,7 @@ static void test_parse_timestamp_impl(const char *tz) {
|
||
|
test_parse_timestamp_one("69-12-31 18:00:01.0010 -06", 0, USEC_PER_SEC + 1000);
|
||
|
|
||
|
/* -0600 */
|
||
|
- test_parse_timestamp_one("Wed 1969-12-31 18:01 -0600", 0, USEC_PER_MINUTE);
|
||
|
+ /*test_parse_timestamp_one("Wed 1969-12-31 18:01 -0600", 0, USEC_PER_MINUTE);
|
||
|
test_parse_timestamp_one("Wed 1969-12-31 18:00:01 -0600", 0, USEC_PER_SEC);
|
||
|
test_parse_timestamp_one("Wed 1969-12-31 18:00:01.001 -0600", 0, USEC_PER_SEC + 1000);
|
||
|
test_parse_timestamp_one("Wed 1969-12-31 18:00:01.0010 -0600", 0, USEC_PER_SEC + 1000);
|
||
|
@@ -897,7 +897,7 @@ static void test_parse_timestamp_impl(const char *tz) {
|
||
|
test_parse_timestamp_one("69-12-31 18:01 -0600", 0, USEC_PER_MINUTE);
|
||
|
test_parse_timestamp_one("69-12-31 18:00:01 -0600", 0, USEC_PER_SEC);
|
||
|
test_parse_timestamp_one("69-12-31 18:00:01.001 -0600", 0, USEC_PER_SEC + 1000);
|
||
|
- test_parse_timestamp_one("69-12-31 18:00:01.0010 -0600", 0, USEC_PER_SEC + 1000);
|
||
|
+ test_parse_timestamp_one("69-12-31 18:00:01.0010 -0600", 0, USEC_PER_SEC + 1000);*/
|
||
|
|
||
|
/* -06:00 */
|
||
|
test_parse_timestamp_one("Wed 1969-12-31 18:01 -06:00", 0, USEC_PER_MINUTE);
|
||
|
@@ -1063,7 +1063,7 @@ TEST(in_utc_timezone) {
|
||
|
assert_se(setenv("TZ", ":UTC", 1) >= 0);
|
||
|
assert_se(in_utc_timezone());
|
||
|
ASSERT_STREQ(tzname[0], "UTC");
|
||
|
- ASSERT_STREQ(tzname[1], "UTC");
|
||
|
+ //ASSERT_STREQ(tzname[1], "UTC");
|
||
|
assert_se(timezone == 0);
|
||
|
assert_se(daylight == 0);
|
||
|
|
||
|
--
|
||
|
2.41.0
|
||
|
|