@@ -8,6 +8,11 @@ TEST_PASSES_SANITIZE_LEAK=true
8
8
# arbitrary reference time: 2009-08-30 19:20:00
9
9
GIT_TEST_DATE_NOW=1251660000; export GIT_TEST_DATE_NOW
10
10
11
+ if test_have_prereq TIME_IS_64BIT,TIME_T_IS_64BIT
12
+ then
13
+ test_set_prereq HAVE_64BIT_TIME
14
+ fi
15
+
11
16
check_relative () {
12
17
t=$(( $GIT_TEST_DATE_NOW - $1 ))
13
18
echo " $t -> $2 " > expect
@@ -80,14 +85,15 @@ check_show raw "$TIME" '1466000000 -0200'
80
85
81
86
# arbitrary time absurdly far in the future
82
87
FUTURE=" 5758122296 -0400"
83
- check_show iso " $FUTURE " " 2152-06-19 18:24:56 -0400" TIME_IS_64BIT,TIME_T_IS_64BIT
84
- check_show iso-local " $FUTURE " " 2152-06-19 22:24:56 +0000" TIME_IS_64BIT,TIME_T_IS_64BIT
88
+ check_show iso " $FUTURE " " 2152-06-19 18:24:56 -0400" HAVE_64BIT_TIME
89
+ check_show iso-local " $FUTURE " " 2152-06-19 22:24:56 +0000" HAVE_64BIT_TIME
85
90
86
- check_parse () {
91
+ REQUIRE_64BIT_TIME=
92
+ check_parse () {
87
93
echo " $1 -> $2 " > expect
88
- test_expect_ ${4 :- success} " parse date ($1 ${3: + TZ=$3 } )" "
89
- TZ=${3:- $TZ } test-tool date parse '$1 ' >actual &&
90
- test_cmp expect actual
94
+ test_expect_success $REQUIRE_64BIT_TIME " parse date ($1 ${3: + TZ=$3 } ) -> $2 " "
95
+ TZ=${3:- $TZ } test-tool date parse '$1 ' >actual &&
96
+ test_cmp expect actual
91
97
"
92
98
}
93
99
@@ -117,6 +123,39 @@ check_parse '2008-02-14 20:30:45 -05:00' '2008-02-14 20:30:45 -0500'
117
123
check_parse ' 2008-02-14 20:30:45' ' 2008-02-14 20:30:45 -0500' EST5
118
124
check_parse ' Thu, 7 Apr 2005 15:14:13 -0700' ' 2005-04-07 15:14:13 -0700'
119
125
126
+ check_parse ' 1970-01-01 00:00:00' ' 1970-01-01 00:00:00 +0000'
127
+ check_parse ' 1970-01-01 00:00:00 +00' ' 1970-01-01 00:00:00 +0000'
128
+ check_parse ' 1970-01-01 00:00:00 Z' ' 1970-01-01 00:00:00 +0000'
129
+ check_parse ' 1970-01-01 00:00:00 -01' ' 1970-01-01 00:00:00 -0100'
130
+ check_parse ' 1970-01-01 00:00:00 +01' bad
131
+ check_parse ' 1970-01-01 00:00:00 +11' bad
132
+ check_parse ' 1970-01-01 00:59:59 +01' bad
133
+ check_parse ' 1970-01-01 01:00:00 +01' ' 1970-01-01 01:00:00 +0100'
134
+ check_parse ' 1970-01-01 01:00:00 +11' bad
135
+ check_parse ' 1970-01-02 00:00:00 +11' ' 1970-01-02 00:00:00 +1100'
136
+ check_parse ' 1969-12-31 23:59:59' bad
137
+ check_parse ' 1969-12-31 23:59:59 +00' bad
138
+ check_parse ' 1969-12-31 23:59:59 Z' bad
139
+ check_parse ' 1969-12-31 23:59:59 +11' bad
140
+ check_parse ' 1969-12-31 23:59:59 -11' bad
141
+
142
+ REQUIRE_64BIT_TIME=HAVE_64BIT_TIME
143
+ check_parse ' 2099-12-31 23:59:59' ' 2099-12-31 23:59:59 +0000'
144
+ check_parse ' 2099-12-31 23:59:59 +00' ' 2099-12-31 23:59:59 +0000'
145
+ check_parse ' 2099-12-31 23:59:59 Z' ' 2099-12-31 23:59:59 +0000'
146
+ check_parse ' 2099-12-31 23:59:59 +01' ' 2099-12-31 23:59:59 +0100'
147
+ check_parse ' 2099-12-31 23:59:59 -01' bad
148
+ check_parse ' 2099-12-31 23:59:59 -11' bad
149
+ check_parse ' 2099-12-31 23:00:00 -01' bad
150
+ check_parse ' 2099-12-31 22:59:59 -01' ' 2099-12-31 22:59:59 -0100'
151
+ check_parse ' 2100-00-00 00:00:00' bad
152
+ check_parse ' 2099-12-30 00:00:00 -11' ' 2099-12-30 00:00:00 -1100'
153
+ check_parse ' 2100-00-00 00:00:00 +00' bad
154
+ check_parse ' 2100-00-00 00:00:00 Z' bad
155
+ check_parse ' 2100-00-00 00:00:00 -11' bad
156
+ check_parse ' 2100-00-00 00:00:00 +11' bad
157
+ REQUIRE_64BIT_TIME=
158
+
120
159
check_approxidate () {
121
160
echo " $1 -> $2 +0000" > expect
122
161
test_expect_${3:- success} " parse approxidate ($1 )" "
0 commit comments