Commit ae0204bf authored by simonmar's avatar simonmar
Browse files

[project @ 2005-12-16 10:54:50 by simonmar]

TimeExts has gone away
parent 44bdbb1f
TOP=../../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
# test for obsolete module
setTestOpts(only_compiler_types(['ghc']))
test('timeexts001', normal, compile_and_run, ['-package lang'])
module Main(main) where
import System.Time
import TimeExts
start = toClockTime(
CalendarTime {
ctYear = 1973,
ctMonth = December,
ctDay = 31,
ctHour = 11,
ctMin = 43,
ctSec = 55,
ctPicosec = 123123123123,
ctWDay = Monday,
ctYDay = 0,
ctTZName = "UTC",
ctTZ = 0,
ctIsDST = False
})
pClock :: ClockTime -> IO()
pClock c =
do
putStr(calendarTimeToString(toUTCTime c))
putStr "\n"
getDiff :: TimeAddable a => ClockTime -> a
getDiff now = diffClock now start
printSum :: TimeAddable a => a -> IO ()
printSum diff =
let
sum = addClock start diff
in
pClock sum
main =
do
-- now <- getClockTime
-- now fixed so we get reliable output (SDM)
let now = TOD 944662832 34398000000
putStr "Start: "
pClock start
putStr "End: "
pClock now
putStr "Whole Picos\n"
printSum((getDiff now)::DiffPico)
putStr "Whole Seconds\n"
printSum((getDiff now)::DiffPico)
putStr "Whole Minutes\n"
printSum((getDiff now)::DiffMinute)
putStr "Whole Hours\n"
printSum((getDiff now)::DiffHour)
putStr "Whole Days\n"
printSum((getDiff now)::DiffDay)
putStr "Whole Months\n"
printSum((getDiff now)::DiffMonth)
putStr "Whole Years\n"
printSum((getDiff now)::DiffYear)
Start: Mon Dec 31 11:43:55 UTC 1973
End: Wed Dec 8 14:20:32 UTC 1999
Whole Picos
Wed Dec 8 14:20:32 UTC 1999
Whole Seconds
Wed Dec 8 14:20:32 UTC 1999
Whole Minutes
Wed Dec 8 14:19:55 UTC 1999
Whole Hours
Wed Dec 8 13:43:55 UTC 1999
Whole Days
Wed Dec 8 11:43:55 UTC 1999
Whole Months
Wed Dec 1 11:43:55 UTC 1999
Whole Years
Thu Dec 31 11:43:55 UTC 1998
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment