Hello community, here is the log from the commit of package ghc-hourglass for openSUSE:Factory checked in at 2018-05-30 12:08:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-hourglass (Old) and /work/SRC/openSUSE:Factory/.ghc-hourglass.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-hourglass" Wed May 30 12:08:41 2018 rev:5 rq:607811 version:0.2.11 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-hourglass/ghc-hourglass.changes 2017-09-15 21:48:59.633202692 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-hourglass.new/ghc-hourglass.changes 2018-05-30 12:25:56.557065869 +0200 @@ -1,0 +2,8 @@ +Mon May 14 17:02:11 UTC 2018 - [email protected] + +- Update hourglass to version 0.2.11. + - Add Zero UTC + - Avoid division by 0 + - Add support for ghc-8.4 alpha2 + +------------------------------------------------------------------- Old: ---- hourglass-0.2.10.tar.gz New: ---- hourglass-0.2.11.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-hourglass.spec ++++++ --- /var/tmp/diff_new_pack.cUvkP5/_old 2018-05-30 12:25:57.321040352 +0200 +++ /var/tmp/diff_new_pack.cUvkP5/_new 2018-05-30 12:25:57.325040219 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-hourglass # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %global pkg_name hourglass %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.2.10 +Version: 0.2.11 Release: 0 Summary: Simple performant time related library License: BSD-3-Clause @@ -76,7 +76,7 @@ %ghc_pkg_recache %files -f %{name}.files -%doc LICENSE +%license LICENSE %files devel -f %{name}-devel.files %doc CHANGELOG.md README.md ++++++ hourglass-0.2.10.tar.gz -> hourglass-0.2.11.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hourglass-0.2.10/CHANGELOG.md new/hourglass-0.2.11/CHANGELOG.md --- old/hourglass-0.2.10/CHANGELOG.md 2016-02-27 12:23:51.000000000 +0100 +++ new/hourglass-0.2.11/CHANGELOG.md 2018-02-04 18:54:42.000000000 +0100 @@ -1,3 +1,19 @@ +## Version 0.2.11 (2018-02-04) + +- Add Zero UTC +- Avoid division by 0 +- Add support for ghc-8.4 alpha2 + +## Version 0.2.10 (2016-02-27) + +- Move towards Time. hierarchy +- Add some test +- Fix some issues + +## Version 0.2.9 (2015-04-01) + +- some tidy up + ## Version 0.2.8 (2015-01-07) - Fix test with time 1.5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hourglass-0.2.10/Data/Hourglass/Diff.hs new/hourglass-0.2.11/Data/Hourglass/Diff.hs --- old/hourglass-0.2.10/Data/Hourglass/Diff.hs 2016-02-27 12:23:51.000000000 +0100 +++ new/hourglass-0.2.11/Data/Hourglass/Diff.hs 2018-02-04 15:41:11.000000000 +0100 @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} -- | -- Module : Data.Hourglass.Diff @@ -38,6 +39,11 @@ instance NFData Period where rnf (Period y m d) = y `seq` m `seq` d `seq` () +#if (MIN_VERSION_base(4,11,0)) +instance Semigroup Period where + (<>) (Period y1 m1 d1) (Period y2 m2 d2) = + Period (y1+y2) (m1+m2) (d1+d2) +#endif instance Monoid Period where mempty = Period 0 0 0 mappend (Period y1 m1 d1) (Period y2 m2 d2) = @@ -54,6 +60,11 @@ instance NFData Duration where rnf (Duration h m s ns) = h `seq` m `seq` s `seq` ns `seq` () +#if (MIN_VERSION_base(4,11,0)) +instance Semigroup Duration where + (<>) (Duration h1 m1 s1 ns1) (Duration h2 m2 s2 ns2) = + Duration (h1+h2) (m1+m2) (s1+s2) (ns1+ns2) +#endif instance Monoid Duration where mempty = Duration 0 0 0 0 mappend (Duration h1 m1 s1 ns1) (Duration h2 m2 s2 ns2) = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hourglass-0.2.10/Data/Hourglass/Format.hs new/hourglass-0.2.11/Data/Hourglass/Format.hs --- old/hourglass-0.2.10/Data/Hourglass/Format.hs 2016-02-27 12:23:51.000000000 +0100 +++ new/hourglass-0.2.11/Data/Hourglass/Format.hs 2017-05-13 09:16:09.000000000 +0200 @@ -61,6 +61,7 @@ | Format_Precision Int -- ^ sub seconds display with a precision of N digits. with N between 1 and 9 | Format_TimezoneName -- ^ timezone name (e.g. GMT, PST). not implemented yet -- | Format_TimezoneOffset -- ^ timeoffset offset (+02:00) + | Format_TzHM_Colon_Z -- ^ zero UTC offset (Z) or timeoffset with colon (+02:00) | Format_TzHM_Colon -- ^ timeoffset offset with colon (+02:00) | Format_TzHM -- ^ timeoffset offset (+0200) | Format_Tz_Offset -- ^ timeoffset in minutes @@ -153,7 +154,7 @@ [Format_Year,dash,Format_Month2,dash,Format_Day2 -- date ,Format_Text 'T' ,Format_Hour,colon,Format_Minute,colon,Format_Second -- time - ,Format_TzHM_Colon -- timezone offset with colon +HH:MM + ,Format_TzHM_Colon_Z -- zero UTC offset (Z) or timezone offset with colon +HH:MM ] where dash = Format_Text '-' colon = Format_Text ':' @@ -202,6 +203,9 @@ fmtToString Format_TimezoneName = "" -- fmtToString Format_Tz_Offset = show tz fmtToString Format_TzHM = show tzOfs + fmtToString Format_TzHM_Colon_Z + | tz == 0 = "Z" + | otherwise = fmtToString Format_TzHM_Colon fmtToString Format_TzHM_Colon = let (tzH, tzM) = abs tz `divMod` 60 sign = if tz < 0 then "-" else "+" @@ -290,6 +294,9 @@ onSuccess (\sec -> let newDate = dateTimeFromUnixEpochP $ flip ElapsedP 0 $ Elapsed $ Seconds sec in modDT (const newDate) acc) $ isNumber s + processOne acc Format_TzHM_Colon_Z a@(c:s) + | c == 'Z' = Right (acc, s) + | otherwise = processOne acc Format_TzHM_Colon a processOne acc Format_TzHM_Colon (c:s) = parseHMSign True acc c s processOne acc Format_TzHM (c:s) = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hourglass-0.2.10/Data/Hourglass.hs new/hourglass-0.2.11/Data/Hourglass.hs --- old/hourglass-0.2.10/Data/Hourglass.hs 2016-02-27 12:23:51.000000000 +0100 +++ new/hourglass-0.2.11/Data/Hourglass.hs 2017-05-13 09:16:09.000000000 +0200 @@ -30,6 +30,7 @@ , isLeapYear , getWeekDay , getDayOfTheYear + , daysInMonth ) where import Data.Hourglass.Time diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hourglass-0.2.10/Time/Types.hs new/hourglass-0.2.11/Time/Types.hs --- old/hourglass-0.2.10/Time/Types.hs 2016-02-27 12:23:51.000000000 +0100 +++ new/hourglass-0.2.11/Time/Types.hs 2017-05-13 09:16:09.000000000 +0200 @@ -149,6 +149,8 @@ instance Real ElapsedP where -- FIXME + toRational (ElapsedP (Elapsed (Seconds s)) (NanoSeconds 0)) = + fromIntegral s toRational (ElapsedP (Elapsed (Seconds s)) (NanoSeconds ns)) = fromIntegral s + (1000000000 % fromIntegral ns) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hourglass-0.2.10/hourglass.cabal new/hourglass-0.2.11/hourglass.cabal --- old/hourglass-0.2.10/hourglass.cabal 2016-02-27 12:23:51.000000000 +0100 +++ new/hourglass-0.2.11/hourglass.cabal 2018-02-04 18:55:31.000000000 +0100 @@ -1,5 +1,5 @@ Name: hourglass -Version: 0.2.10 +Version: 0.2.11 Synopsis: simple performant time related library Description: Simple time library focusing on simple but powerful and performant API @@ -77,7 +77,7 @@ Default-Language: Haskell2010 Build-depends: base >= 4 && < 5 , bytestring - , criterion + , gauge , mtl , deepseq , hourglass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hourglass-0.2.10/tests/Bench.hs new/hourglass-0.2.11/tests/Bench.hs --- old/hourglass-0.2.10/tests/Bench.hs 2016-02-27 12:23:51.000000000 +0100 +++ new/hourglass-0.2.11/tests/Bench.hs 2018-02-04 16:30:18.000000000 +0100 @@ -2,7 +2,7 @@ {-# LANGUAGE BangPatterns #-} module Main (main) where -import Criterion.Main +import Gauge.Main import Data.Hourglass import System.Hourglass import TimeDB diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hourglass-0.2.10/tests/Tests.hs new/hourglass-0.2.11/tests/Tests.hs --- old/hourglass-0.2.10/tests/Tests.hs 2016-02-27 12:23:51.000000000 +0100 +++ new/hourglass-0.2.11/tests/Tests.hs 2017-05-13 09:16:09.000000000 +0200 @@ -53,12 +53,9 @@ -- | The @Date@ type is able to represent some values that aren't actually legal, -- specifically dates with a day field outside of the range of dates in the --- month. This function validates a @Date@. It is conservative; it only verifies --- that the day is less than 31. TODO: It would be nice to tighten this up a --- bit. There's a daysInMonth function we could use for this, --- but Data.Hourglass.Calendar, but it isn't exposed. +-- month. This function validates a @Date@. isValidDate :: Date -> Bool -isValidDate (Date _ _ d) = d > 0 && d <= 31 +isValidDate (Date y m d) = d > 0 && d <= (daysInMonth y m) -- windows native functions to convert time cannot handle time before year 1601 #ifdef WINDOWS @@ -105,9 +102,10 @@ instance Arbitrary DateTime where arbitrary = DateTime <$> arbitrary <*> arbitrary instance Arbitrary Date where - arbitrary = Date <$> choose dateRange - <*> arbitrary - <*> choose (1,28) + arbitrary = do + year <- choose dateRange + month <- arbitrary + Date year month <$> choose (1, daysInMonth year month) instance Arbitrary TimeOfDay where arbitrary = TimeOfDay <$> (Hours <$> choose (0,23)) <*> (Minutes <$> choose (0,59)) @@ -192,6 +190,10 @@ (toEnum ((fromEnum m+1) `mod` 12) `eq` m') && (if m == December then (y+1) `eq` y' else y `eq` y') -} + + -- Make sure our Arbitrary instance only generates valid dates: + , testProperty "Arbitrary-isValidDate" isValidDate + , testProperty "dateAddPeriod" $ (\date period -> isValidDate (date `dateAddPeriod` period)) ] @@ -222,6 +224,12 @@ , testProperty "custom-1" $ test_property_format ("YYYY-MM-DDTH:MI:S.msusns" :: String) , testProperty "custom-2" $ test_property_format ("Mon DD\\t\\h YYYY at HH\\hMI\\mS\\s.p9\\n\\s" :: String) ] + , testGroup "Regression Tests" + [ testCase "Real instance of ElapsedP (#33)" $ + let res = toRational (ElapsedP (Elapsed $ Seconds 0) (NanoSeconds 0)) + ref = toRational 0 :: Rational + in assertEqual "failed equality" ref res + ] ] where toCalendarTest (i, (us, dt)) = testCase (show i) (dt @=? timeGetDateTimeOfDay us)
