From 76b8ca2b62a41a3bddf727de841d35aac11df6d5 Mon Sep 17 00:00:00 2001 From: Ashley Yakeley <ashley@semantic.org> Date: Sun, 5 Feb 2006 22:36:47 -0800 Subject: [PATCH] add missing file; README file; root Makefile clean fix darcs-hash:20060206063647-ac6dd-e953bb4a546bdbadc1547fcc27f8f30f537eb435 --- Makefile | 2 +- README | 24 ++++++++++++++++++++++++ time/Data/Time/Clock/UTCDiff.hs | 15 +++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 README create mode 100644 time/Data/Time/Clock/UTCDiff.hs diff --git a/Makefile b/Makefile index 571d69a..46d68a2 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,6 @@ doc: sources haddock -h -o haddock `cat sources` clean: - rm -f sources + rm -f sources haddock cd time && make clean cd fixed && make clean diff --git a/README b/README new file mode 100644 index 0000000..7661654 --- /dev/null +++ b/README @@ -0,0 +1,24 @@ +This contains two packages, "fixed" and "time". They can each be built with Cabal. "time" depends on "fixed". + + cd fixed + runghc Setup.hs configure + runghc Setup.hs build + sudo runghc Setup.hs install + cd .. + + cd time + runghc Setup.hs configure + runghc Setup.hs build + sudo runghc Setup.hs install + cd .. + +You can use it with ghci: + + $ ghci + Prelude> :m +Data.Time + Prelude Data.Time> t <- getCurrentTime + Prelude Data.Time> t + 2006-02-06 06:31:43.859082 UTC + Prelude Data.Time> zt <- getZonedTime + Prelude Data.Time> zt + 2006-02-05 22:32:32.948607 PST diff --git a/time/Data/Time/Clock/UTCDiff.hs b/time/Data/Time/Clock/UTCDiff.hs new file mode 100644 index 0000000..66a2a48 --- /dev/null +++ b/time/Data/Time/Clock/UTCDiff.hs @@ -0,0 +1,15 @@ +{-# OPTIONS -Wall -Werror #-} + +-- #hide +module Data.Time.Clock.UTCDiff where + +import Data.Time.Clock.POSIX +import Data.Time.Clock.UTC + +-- | addUTCTime a b = a + b +addUTCTime :: NominalDiffTime -> UTCTime -> UTCTime +addUTCTime x t = posixSecondsToUTCTime (x + (utcTimeToPOSIXSeconds t)) + +-- | diffUTCTime a b = a - b +diffUTCTime :: UTCTime -> UTCTime -> NominalDiffTime +diffUTCTime a b = (utcTimeToPOSIXSeconds a) - (utcTimeToPOSIXSeconds b) -- GitLab