-
import Time
-main =
- getClockTime >>= \ time ->
- print (length (show time)) >>
-
+main :: IO ()
+main = do
+ time <- getClockTime
+ let l = length (show time)
+ print (l == 28 || l == 29) -- "CEST" vs "UTC" vs "GMT" vs...
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")))))
- in
- print (length time2)
+ l2 = length time2
+ print (l == 28 || l == 29)
where
wdays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
import Time
-main =
- getClockTime >>= \ time ->
+main :: IO ()
+main = do
+ time <- getClockTime
let (CalendarTime year month mday hour min sec psec
wday yday timezone gmtoff isdst) = toUTCTime time
time' = toClockTime (CalendarTime (year - 1) month mday hour min sec psec
wday yday timezone gmtoff isdst)
- in
- print (length (show time)) >>
- putChar '\n' >>
- print (length (show time')) >>
- putChar '\n'
+ print (length (show time) == length (show time'))