diff options
Diffstat (limited to 'testsuite/tests/lib/Time/time003.hs')
-rw-r--r-- | testsuite/tests/lib/Time/time003.hs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/tests/lib/Time/time003.hs b/testsuite/tests/lib/Time/time003.hs new file mode 100644 index 0000000000..4dda0e466f --- /dev/null +++ b/testsuite/tests/lib/Time/time003.hs @@ -0,0 +1,24 @@ +import System.Time + +main :: IO () +main = do + time <- getClockTime + print (plausible (show time)) + let (CalendarTime year month mday hour min sec psec + wday yday timezone gmtoff isdst) = toUTCTime time + time2 = wdays !! fromEnum wday ++ + (' ' : months !! fromEnum month) ++ + (' ' : shows2 mday (' ' : shows2 hour (':' : shows2 min (':' : shows2 sec + (' ' : timezone ++ ' ' : shows year "\n"))))) + print (plausible time2) + + where + wdays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] + months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] + shows2 x = showString (pad2 x) + pad2 x = case show x of + c@[_] -> '0' : c + cs -> cs + + plausible str = filter (== ':') str == "::"
\ No newline at end of file |