clock 0.8.3 → 0.8.4
raw patch · 3 files changed
+64/−22 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- LICENSE +1/−2
- System/Clock.hsc +55/−14
- clock.cabal +8/−6
LICENSE view
@@ -1,5 +1,4 @@-Copyright (c) 2009-2012, Cetin Sert-Copyright (c) 2010, Eugene Kirpichov+Copyright (c) 2009-2022, Clock Contributors All rights reserved.
System/Clock.hsc view
@@ -3,6 +3,7 @@ -- 1003.1-2008: <http://www.opengroup.org/onlinepubs/9699919799/>, -- <http://www.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html#> +{-# LANGUAGE CApiFFI #-} {-# OPTIONS_GHC -fno-warn-type-defaults #-} -- To allow importing Data.Int and Data.Word indiscriminately on all platforms, -- since we can't systematically predict what typedef's expand to.@@ -34,11 +35,17 @@ #if defined(_WIN32) # include "hs_clock_win32.c"+# define HS_CLOCK_HAVE_PROCESS_CPUTIME+# define HS_CLOCK_HAVE_THREAD_CPUTIME #else # include <time.h>-# ifndef CLOCK_PROCESS_CPUTIME_ID-# define CLOCK_PROCESS_CPUTIME_ID 15+# ifdef CLOCK_PROCESS_CPUTIME_ID+# define HS_CLOCK_HAVE_PROCESS_CPUTIME # endif+# ifdef CLOCK_THREAD_CPUTIME_ID+# define HS_CLOCK_HAVE_THREAD_CPUTIME+# endif+import System.Posix.Types #endif #if __GLASGOW_HASKELL__ < 800@@ -71,15 +78,19 @@ -- @CLOCK_REALTIME@ (macOS - @CALENDAR_CLOCK@, Windows - @GetSystemTimeAsFileTime@) | Realtime +#ifdef HS_CLOCK_HAVE_PROCESS_CPUTIME -- | The identifier of the CPU-time clock associated with the calling -- process. For this clock, the value returned by 'getTime' represents the -- amount of execution time of the current process. | ProcessCPUTime+#endif +#ifdef HS_CLOCK_HAVE_THREAD_CPUTIME -- | The identifier of the CPU-time clock associated with the calling OS -- thread. For this clock, the value returned by 'getTime' represents the -- amount of execution time of the current OS thread. | ThreadCPUTime+#endif #if defined (CLOCK_MONOTONIC_RAW) -- | (since Linux 2.6.28, macOS 10.12)@@ -132,28 +143,58 @@ foreign import ccall unsafe hs_clock_win32_getres_processtime :: Ptr TimeSpec -> IO () foreign import ccall unsafe hs_clock_win32_getres_threadtime :: Ptr TimeSpec -> IO () #else-foreign import ccall unsafe clock_gettime :: #{type clockid_t} -> Ptr TimeSpec -> IO CInt-foreign import ccall unsafe clock_getres :: #{type clockid_t} -> Ptr TimeSpec -> IO CInt+#if MIN_VERSION_base(4,10,0)+type ClockId = CClockId+#else+type ClockId = #{type clockid_t} #endif -#if !defined(_WIN32)-clockToConst :: Clock -> #{type clockid_t}-clockToConst Monotonic = #const CLOCK_MONOTONIC-clockToConst Realtime = #const CLOCK_REALTIME-clockToConst ProcessCPUTime = #const CLOCK_PROCESS_CPUTIME_ID-clockToConst ThreadCPUTime = #const CLOCK_THREAD_CPUTIME_ID+foreign import ccall unsafe clock_gettime :: ClockId -> Ptr TimeSpec -> IO CInt+foreign import ccall unsafe clock_getres :: ClockId -> Ptr TimeSpec -> IO CInt +foreign import capi unsafe "time.h value CLOCK_MONOTONIC" clock_MONOTONIC :: ClockId+foreign import capi unsafe "time.h value CLOCK_REALTIME" clock_REALTIME :: ClockId+#if defined (CLOCK_PROCESS_CPUTIME_ID)+foreign import capi unsafe "time.h value CLOCK_PROCESS_CPUTIME_ID" clock_PROCESS_CPUTIME_ID :: ClockId+#endif+#if defined (CLOCK_THREAD_CPUTIME_ID)+foreign import capi unsafe "time.h value CLOCK_THREAD_CPUTIME_ID" clock_THREAD_CPUTIME_ID :: ClockId+#endif #if defined (CLOCK_MONOTONIC_RAW)-clockToConst MonotonicRaw = #const CLOCK_MONOTONIC_RAW+foreign import capi unsafe "time.h value CLOCK_MONOTONIC_RAW" clock_MONOTONIC_RAW :: ClockId #endif #if defined (CLOCK_BOOTTIME)-clockToConst Boottime = #const CLOCK_BOOTTIME+foreign import capi unsafe "time.h value CLOCK_BOOTTIME" clock_BOOTTIME :: ClockId #endif #if defined (CLOCK_MONOTONIC_COARSE)-clockToConst MonotonicCoarse = #const CLOCK_MONOTONIC_COARSE+foreign import capi unsafe "time.h value CLOCK_MONOTONIC_COARSE" clock_MONOTONIC_COARSE :: ClockId #endif #if defined (CLOCK_REALTIME_COARSE)-clockToConst RealtimeCoarse = #const CLOCK_REALTIME_COARSE+foreign import capi unsafe "time.h value CLOCK_REALTIME_COARSE" clock_REALTIME_COARSE :: ClockId+#endif+#endif++#if !defined(_WIN32)+clockToConst :: Clock -> ClockId+clockToConst Monotonic = clock_MONOTONIC+clockToConst Realtime = clock_REALTIME+#if defined (CLOCK_PROCESS_CPUTIME_ID)+clockToConst ProcessCPUTime = clock_PROCESS_CPUTIME_ID+#endif+#if defined (CLOCK_THREAD_CPUTIME_ID)+clockToConst ThreadCPUTime = clock_THREAD_CPUTIME_ID+#endif+#if defined (CLOCK_MONOTONIC_RAW)+clockToConst MonotonicRaw = clock_MONOTONIC_RAW+#endif+#if defined (CLOCK_BOOTTIME)+clockToConst Boottime = clock_BOOTTIME+#endif+#if defined (CLOCK_MONOTONIC_COARSE)+clockToConst MonotonicCoarse = clock_MONOTONIC_COARSE+#endif+#if defined (CLOCK_REALTIME_COARSE)+clockToConst RealtimeCoarse = clock_REALTIME_COARSE #endif #endif
clock.cabal view
@@ -1,6 +1,6 @@ cabal-version: >= 1.10 name: clock-version: 0.8.3+version: 0.8.4 stability: stable synopsis: High-resolution clock functions: monotonic, realtime, cputime. description: A package for convenient access to high-resolution clock and@@ -43,18 +43,20 @@ . * @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, Mario Longobardi 2016, Alexander Vershilov 2021.+copyright: Copyright © Cetin Sert 2009-2023, 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, Alexander Vershilov 2021. license: BSD3 license-file: LICENSE-author: Cetin Sert <cetin@sert.works>, Corsis Research-maintainer: Cetin Sert <cetin@sert.works>, Corsis Research+author: Cetin Sert <cetin@elefunc.com>, Elefunc, Inc.+maintainer: Cetin Sert <cetin@elefunc.com>, Elefunc, Inc. homepage: https://github.com/corsis/clock bug-reports: https://github.com/corsis/clock/issues category: System build-type: Simple tested-with:- GHC == 9.2.1+ GHC == 9.6.1+ GHC == 9.4.4+ GHC == 9.2.7 GHC == 9.0.2 GHC == 8.10.7 GHC == 8.8.4@@ -71,7 +73,7 @@ source-repository head type: git- location: git://github.com/corsis/clock.git+ location: https://github.com/corsis/clock.git flag llvm