[commit: packages/time] master: add missing file; README file; root Makefile clean fix (76b8ca2)

git at git.haskell.org git at git.haskell.org
Sun Dec 20 07:49:07 UTC 2015


Repository : ssh://git@git.haskell.org/time

On branch  : master
Link       : http://git.haskell.org/packages/time.git/commitdiff/76b8ca2b62a41a3bddf727de841d35aac11df6d5

>---------------------------------------------------------------

commit 76b8ca2b62a41a3bddf727de841d35aac11df6d5
Author: Ashley Yakeley <ashley at semantic.org>
Date:   Sun Feb 5 22:36:47 2006 -0800

    add missing file; README file; root Makefile clean fix
    
    darcs-hash:20060206063647-ac6dd-e953bb4a546bdbadc1547fcc27f8f30f537eb435


>---------------------------------------------------------------

76b8ca2b62a41a3bddf727de841d35aac11df6d5
 Makefile                        |  2 +-
 README                          | 24 ++++++++++++++++++++++++
 time/Data/Time/Clock/UTCDiff.hs | 15 +++++++++++++++
 3 files changed, 40 insertions(+), 1 deletion(-)

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)



More information about the ghc-commits mailing list