Hello community, here is the log from the commit of package ghc-clock for openSUSE:Factory checked in at 2016-05-31 12:24:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-clock (Old) and /work/SRC/openSUSE:Factory/.ghc-clock.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-clock" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-clock/ghc-clock.changes 2016-01-08 15:23:10.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-clock.new/ghc-clock.changes 2016-05-31 12:24:15.000000000 +0200 @@ -2 +2 @@ -Mon Dec 21 09:09:09 UTC 2015 - [email protected] +Fri Apr 29 08:57:13 UTC 2016 - [email protected] @@ -4,6 +4 @@ -- update to 0.6.0.1 - -------------------------------------------------------------------- -Thu Dec 17 10:36:50 UTC 2015 - [email protected] - -- update to 0.5.2 +- update to 0.7.2 Old: ---- clock-0.6.0.1.tar.gz New: ---- clock-0.7.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-clock.spec ++++++ --- /var/tmp/diff_new_pack.xzRuqk/_old 2016-05-31 12:24:16.000000000 +0200 +++ /var/tmp/diff_new_pack.xzRuqk/_new 2016-05-31 12:24:16.000000000 +0200 @@ -19,7 +19,7 @@ %global pkg_name clock Name: ghc-clock -Version: 0.6.0.1 +Version: 0.7.2 Release: 0 Summary: High-resolution clock functions: monotonic, realtime, cputime License: BSD-3-Clause ++++++ clock-0.6.0.1.tar.gz -> clock-0.7.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clock-0.6.0.1/System/Clock.hsc new/clock-0.7.2/System/Clock.hsc --- old/clock-0.6.0.1/System/Clock.hsc 2015-12-15 12:42:48.000000000 +0100 +++ new/clock-0.7.2/System/Clock.hsc 2016-04-20 03:14:45.000000000 +0200 @@ -13,6 +13,8 @@ , TimeSpec(..) , getTime , getRes + , fromNanoSecs + , toNanoSecs , diffTimeSpec , timeSpecAsNanoSecs ) where @@ -61,29 +63,30 @@ = Monotonic -- | The identifier of the system-wide clock measuring real time. For this - -- clock, the value returned by getTime represents the amount of time (in + -- clock, the value returned by 'getTime' represents the amount of time (in -- seconds and nanoseconds) since the Epoch. | Realtime -- | The identifier of the CPU-time clock associated with the calling - -- process. For this clock, the value returned by getTime represents the + -- process. For this clock, the value returned by 'getTime' represents the -- amount of execution time of the current process. | ProcessCPUTime -- | The identifier of the CPU-time clock associated with the calling OS - -- thread. For this clock, the value returned by getTime represents the + -- thread. For this clock, the value returned by 'getTime' represents the -- amount of execution time of the current OS thread. | ThreadCPUTime -#if defined (linux_HOST_OS) - +#if defined (CLOCK_MONOTONIC_RAW) -- | (since Linux 2.6.28; Linux-specific) -- Similar to CLOCK_MONOTONIC, but provides access to a -- raw hardware-based time that is not subject to NTP -- adjustments or the incremental adjustments performed by -- adjtime(3). | MonotonicRaw +#endif +#if defined (CLOCK_BOOTTIME) -- | (since Linux 2.6.39; Linux-specific) -- Identical to CLOCK_MONOTONIC, except it also includes -- any time that the system is suspended. This allows @@ -92,17 +95,20 @@ -- CLOCK_REALTIME, which may have discontinuities if the -- time is changed using settimeofday(2). | Boottime +#endif +#if defined (CLOCK_MONOTONIC_COARSE) -- | (since Linux 2.6.32; Linux-specific) -- A faster but less precise version of CLOCK_MONOTONIC. -- Use when you need very fast, but not fine-grained timestamps. | MonotonicCoarse +#endif +#if defined (CLOCK_REALTIME_COARSE) -- | (since Linux 2.6.32; Linux-specific) -- A faster but less precise version of CLOCK_REALTIME. -- Use when you need very fast, but not fine-grained timestamps. | RealtimeCoarse - #endif deriving (Eq, Enum, Generic, Read, Show, Typeable) @@ -137,12 +143,23 @@ clockToConst Realtime = #const CLOCK_REALTIME clockToConst ProcessCPUTime = #const CLOCK_PROCESS_CPUTIME_ID clockToConst ThreadCPUTime = #const CLOCK_THREAD_CPUTIME_ID -#if defined (linux_HOST_OS) + +#if defined (CLOCK_MONOTONIC_RAW) clockToConst MonotonicRaw = #const CLOCK_MONOTONIC_RAW +#endif + +#if defined (CLOCK_BOOTTIME) clockToConst Boottime = #const CLOCK_BOOTTIME +#endif + +#if defined (CLOCK_MONOTONIC_COARSE) clockToConst MonotonicCoarse = #const CLOCK_MONOTONIC_COARSE +#endif + +#if defined (CLOCK_REALTIME_COARSE) clockToConst RealtimeCoarse = #const CLOCK_REALTIME_COARSE #endif + #endif allocaAndPeek :: Storable a => (Ptr a -> IO ()) -> IO a @@ -163,9 +180,9 @@ getTime ProcessCPUTime = allocaAndPeek hs_clock_win32_gettime_processtime getTime ThreadCPUTime = allocaAndPeek hs_clock_win32_gettime_threadtime #elif defined(__MACH__) && defined(__APPLE__) -getTime clk = allocaAndPeek $ hs_clock_darwin_gettime $ clockToConst clk +getTime clk = allocaAndPeek $! hs_clock_darwin_gettime $! clockToConst clk #else -getTime clk = allocaAndPeek $ clock_gettime $ clockToConst clk +getTime clk = allocaAndPeek $! clock_gettime $! clockToConst clk #endif #if defined(_WIN32) @@ -174,9 +191,9 @@ getRes ProcessCPUTime = allocaAndPeek hs_clock_win32_getres_processtime getRes ThreadCPUTime = allocaAndPeek hs_clock_win32_getres_threadtime #elif defined(__MACH__) && defined(__APPLE__) -getRes clk = allocaAndPeek $ hs_clock_darwin_getres $ clockToConst clk +getRes clk = allocaAndPeek $! hs_clock_darwin_getres $! clockToConst clk #else -getRes clk = allocaAndPeek $ clock_getres $ clockToConst clk +getRes clk = allocaAndPeek $! clock_getres $! clockToConst clk #endif -- | TimeSpec structure @@ -211,27 +228,36 @@ return $ TimeSpec (fromIntegral xs) (fromIntegral xn) #endif +s2ns :: Num a => a +s2ns = 10^9 + normalize :: TimeSpec -> TimeSpec -normalize (TimeSpec xs xn) | xn < 0 || xn >= 10^9 = TimeSpec (xs + q) r +normalize (TimeSpec xs xn) | xn < 0 || xn >= s2ns = TimeSpec (xs + q) r | otherwise = TimeSpec xs xn - where (q, r) = xn `divMod` (10^9) + where (q, r) = xn `divMod` s2ns instance Num TimeSpec where (TimeSpec xs xn) + (TimeSpec ys yn) = normalize $! TimeSpec (xs + ys) (xn + yn) (TimeSpec xs xn) - (TimeSpec ys yn) = normalize $! TimeSpec (xs - ys) (xn - yn) - (TimeSpec xs xn) * (TimeSpec ys yn) = - let xsi = toInteger xs -- convert to arbitraty Integer type to avoid int overflow - xni = toInteger xn - ysi = toInteger ys - yni = toInteger yn -- seconds -- nanoseconds - in normalize $! TimeSpec (fromInteger $! xsi * ysi) (fromInteger $! (xni * yni + (xni * ysi + xsi * yni) * (10^9)) `div` (10^9)) - negate (TimeSpec xs xn) = - normalize $ TimeSpec (negate xs) (negate xn) + (TimeSpec xs xn) * (TimeSpec ys yn) = normalize $! TimeSpec (xsi_ysi) (xni_yni) + where xsi_ysi = fromInteger $! xsi*ysi + xni_yni = fromInteger $! (xni*yni + (xni*ysi + xsi*yni) * s2ns) `div` s2ns + xsi = toInteger xs + ysi = toInteger ys + xni = toInteger xn + yni = toInteger yn +-- let xsi = toInteger xs -- convert to arbitraty Integer type to avoid int overflow +-- xni = toInteger xn +-- ysi = toInteger ys +-- yni = toInteger yn -- seconds -- nanoseconds +-- in normalize $! TimeSpec (fromInteger $! xsi * ysi) (fromInteger $! (xni * yni + (xni * ysi + xsi * yni) * s2ns) `div` s2ns) + + negate (TimeSpec xs xn) = normalize $! TimeSpec (negate xs) (negate xn) abs (normalize -> TimeSpec xs xn) | xs == 0 = normalize $! TimeSpec 0 xn | otherwise = normalize $! TimeSpec (abs xs) (signum xs * xn) signum (normalize -> TimeSpec xs xn) | xs == 0 = TimeSpec (signum xn) 0 | otherwise = TimeSpec (signum xs) 0 ---fromInteger x = TimeSpec (fromInteger q) (fromInteger r) where (q, r) = x `divMod` (10^9) + fromInteger x = TimeSpec (fromInteger q) (fromInteger r) where (q, r) = x `divMod` s2ns instance Eq TimeSpec where (normalize -> TimeSpec xs xn) == (normalize -> TimeSpec ys yn) | True == es = xn == yn @@ -243,10 +269,20 @@ | otherwise = os where os = compare xs ys +-- | TimeSpec from nano seconds. +fromNanoSecs :: Integer -> TimeSpec +fromNanoSecs x = TimeSpec (fromInteger q) (fromInteger r) where (q, r) = x `divMod` s2ns + + +-- | TimeSpec to nano seconds. +toNanoSecs :: TimeSpec -> Integer +toNanoSecs (TimeSpec (toInteger -> s) (toInteger -> n)) = s * s2ns + n + -- | Compute the absolute difference. diffTimeSpec :: TimeSpec -> TimeSpec -> TimeSpec diffTimeSpec ts1 ts2 = abs (ts1 - ts2) +{-# DEPRECATED timeSpecAsNanoSecs "Use toNanoSecs instead! Replaced timeSpecAsNanoSecs with the same signature TimeSpec -> Integer" #-} -- | TimeSpec as nano seconds. timeSpecAsNanoSecs :: TimeSpec -> Integer -timeSpecAsNanoSecs t = toInteger (sec t) * (10^9) + toInteger (nsec t) \ No newline at end of file +timeSpecAsNanoSecs (TimeSpec s n) = toInteger s * s2ns + toInteger n diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clock-0.6.0.1/clock.cabal new/clock-0.7.2/clock.cabal --- old/clock-0.6.0.1/clock.cabal 2015-12-15 12:42:48.000000000 +0100 +++ new/clock-0.7.2/clock.cabal 2016-04-20 03:14:45.000000000 +0200 @@ -1,5 +1,5 @@ name: clock -version: 0.6.0.1 +version: 0.7.2 stability: stable synopsis: High-resolution clock functions: monotonic, realtime, cputime. description: A package for convenient access to high-resolution clock and @@ -29,12 +29,16 @@ . New Linux-specific Clocks: MonotonicRaw, Boottime, MonotonicCoarse, RealtimeCoarse by Cetin Sert on 2015-12-15. . + Reintroduction fromInteger : Integer -> TimeSpec by Cetin Sert on 2016-04-05. + . + Fixes for older Linux build failures introduced by new Linux-specific clocks by Mario Longobardi on 2016-04-18. + . [Version Scheme] Major-@/R/@-ewrite . New-@/F/@-unctionality . @/I/@-mprovementAndBugFixes . @/P/@-ackagingOnly . * @PackagingOnly@ changes are made for quality assurance reasons. -copyright: Copyright © Cetin Sert 2009-2016, Eugene Kirpichov 2010, Finn Espen Gundersen 2013, Gerolf Seitz 2013, Mathieu Boespflug 2014 2015, Chris Done 2015, Dimitri Sabadie 2015, Christian Burger 2015 +copyright: Copyright © Cetin Sert 2009-2016, Eugene Kirpichov 2010, Finn Espen Gundersen 2013, Gerolf Seitz 2013, Mathieu Boespflug 2014 2015, Chris Done 2015, Dimitri Sabadie 2015, Christian Burger 2015, Mario Longobardi 2016 license: BSD3 license-file: LICENSE author: Cetin Sert <[email protected]>, Corsis Research
