039024f904502a5c576dc7d3825f7f2b256a66be
[ghc-hetmet.git] / ghc / tests / io / should_run / io019.hs
1
2 import Time
3
4 main = 
5     getClockTime                 >>= \ time ->
6     print   (length (show time)) >>
7
8     let (CalendarTime year month mday hour min sec psec 
9                       wday yday timezone gmtoff isdst) = toUTCTime time
10         time2 = wdays !! fromEnum wday ++
11                 (' ' : months !! fromEnum month) ++
12                 (' ' : shows2 mday (' ' : shows2 hour (':' : shows2 min (':' : shows2 sec
13                 (' ' : timezone ++ ' ' : shows year "\n")))))
14     in  
15     print (length time2)
16
17   where
18     wdays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
19     months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", 
20               "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
21     shows2 x = showString (pad2 x)
22     pad2 x = case show x of
23                c@[_] -> '0' : c
24                cs -> cs