[commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Eq and Ord instances for UTCTime (2ba76c8)

git at git.haskell.org git at git.haskell.org
Fri Apr 21 16:44:00 UTC 2017


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

On branches: format-widths,ghc,improve-leapseconds,master,posix-perf,tasty,wip/travis
Link       : http://git.haskell.org/packages/time.git/commitdiff/2ba76c8d8b27054af0ed3d6e84117d4669315998

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

commit 2ba76c8d8b27054af0ed3d6e84117d4669315998
Author: Ashley Yakeley <ashley at semantic.org>
Date:   Thu Apr 28 02:52:24 2005 -0700

    Eq and Ord instances for UTCTime
    
    darcs-hash:20050428095224-ac6dd-7134a7acb637c0b575d82a6d1e96fab36e834c5a


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

2ba76c8d8b27054af0ed3d6e84117d4669315998
 System/Time/Clock.hs | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/System/Time/Clock.hs b/System/Time/Clock.hs
index 2683841..5cb946e 100644
--- a/System/Time/Clock.hs
+++ b/System/Time/Clock.hs
@@ -74,6 +74,14 @@ data UTCTime = UTCTime {
 	utctDayTime :: DiffTime
 }
 
+instance Eq UTCTime where
+	(UTCTime da ta) == (UTCTime db tb) = (da == db) && (ta == tb)
+
+instance Ord UTCTime where
+	compare (UTCTime da ta) (UTCTime db tb) = case (compare da db) of
+		EQ -> compare ta tb
+		cmp -> cmp
+
 -- | a length of time for UTC, ignoring leap-seconds
 newtype UTCDiffTime = MkUTCDiffTime Pico deriving (Eq,Ord)
 



More information about the ghc-commits mailing list