Fix portability of strptime especially for Windows (#3342)

This commit is contained in:
itchyny authored and GitHub committed 2025-06-14 08:00:55 +09:00
1 parent 859a8073ee
commit 7cc202aa6e
3 files changed
+16 -22

No files matched your search

+14 -2
View File
@@ -1810,8 +1810,6 @@ try ["OK", bsearch(0)] catch ["KO",.]
"aa"
["KO","string (\"aa\") cannot be searched from"]
# strptime tests are in optional.test
strftime("%Y-%m-%dT%H:%M:%SZ")
[2015,2,5,23,51,47,4,63]
"2015-03-05T23:51:47Z"
@@ -1854,6 +1852,20 @@ try ["OK", strflocaltime({})] catch ["KO", .]
0
["KO","strflocaltime/1 requires a string format"]
[strptime("%Y-%m-%dT%H:%M:%SZ")|(.,mktime)]
"2015-03-05T23:51:47Z"
[[2015,2,5,23,51,47,4,63],1425599507]
[strptime("%FT%T")|(.,mktime)]
"2025-06-07T08:09:10"
[[2025,5,7,8,9,10,6,157],1749283750]
# Check day-of-week and day of year computations
# (should trip an assert if this fails)
last(range(365 * 67)|("1970-03-01T01:02:03Z"|strptime("%Y-%m-%dT%H:%M:%SZ")|mktime) + (86400 * .)|strftime("%Y-%m-%dT%H:%M:%SZ")|strptime("%Y-%m-%dT%H:%M:%SZ"))
null
[2037,1,11,1,2,3,3,41]
# module system
import "a" as foo; import "b" as bar; def fooa: foo::a; [fooa, bar::a, bar::b, foo::a]
null