@@ -8,6 +8,11 @@ TEST_PASSES_SANITIZE_LEAK=true
88# arbitrary reference time: 2009-08-30 19:20:00
99GIT_TEST_DATE_NOW=1251660000; export GIT_TEST_DATE_NOW
1010
11+ if test_have_prereq TIME_IS_64BIT,TIME_T_IS_64BIT
12+ then
13+ test_set_prereq HAVE_64BIT_TIME
14+ fi
15+
1116check_relative () {
1217 t=$(( $GIT_TEST_DATE_NOW - $1 ))
1318 echo " $t -> $2 " > expect
@@ -80,14 +85,15 @@ check_show raw "$TIME" '1466000000 -0200'
8085
8186# arbitrary time absurdly far in the future
8287FUTURE=" 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
8590
86- check_parse () {
91+ REQUIRE_64BIT_TIME=
92+ check_parse () {
8793 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
9197 "
9298}
9399
@@ -117,6 +123,39 @@ check_parse '2008-02-14 20:30:45 -05:00' '2008-02-14 20:30:45 -0500'
117123check_parse ' 2008-02-14 20:30:45' ' 2008-02-14 20:30:45 -0500' EST5
118124check_parse ' Thu, 7 Apr 2005 15:14:13 -0700' ' 2005-04-07 15:14:13 -0700'
119125
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+
120159check_approxidate () {
121160 echo " $1 -> $2 +0000" > expect
122161 test_expect_${3:- success} " parse approxidate ($1 )" "
0 commit comments