1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-20 18:27:40 +00:00

Added os.strftime()

This commit is contained in:
Ico Doornekamp
2023-05-08 21:29:29 +02:00
parent c9fd2bdf39
commit 5cd729c4c1
2 changed files with 71 additions and 27 deletions

View File

@@ -239,6 +239,12 @@
(assert (= (os/mktime (os/date now true) true) now) "local os/mktime")
(assert (= (os/mktime {:year 1970}) 0) "os/mktime default values")
# OS strftime test
(assert (= (os/strftime "%Y-%m-%d %H:%M:%S" 0) "1970-01-01 00:00:00") "strftime UTC epoch")
(assert (= (os/strftime "%Y-%m-%d %H:%M:%S" 1388608200) "2014-01-01 20:30:00") "strftime january 2014")
(assert (= (try (os/strftime "%%%d%t") ([err] err)) "invalid conversion specifier '%t'") "invalid conversion specifier")
# Appending buffer to self
(with-dyns [:out @""]