Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow extra Clock constructors in clockToConst #59

Merged
merged 1 commit into from
Apr 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions System/Clock.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ foreign import ccall unsafe clock_gettime :: #{type clockid_t} -> Ptr TimeSpec -
foreign import ccall unsafe clock_getres :: #{type clockid_t} -> Ptr TimeSpec -> IO ()
#endif

#if defined(_WIN32)
#elif defined(__MACH__) && defined(__APPLE__)
#if !defined(_WIN32)
#if defined(__MACH__) && defined(__APPLE__)
clockToConst :: Clock -> #{type clock_id_t}
clockToConst Monotonic = #const SYSTEM_CLOCK
clockToConst Realtime = #const CALENDAR_CLOCK
Expand All @@ -145,23 +145,20 @@ clockToConst Monotonic = #const CLOCK_MONOTONIC
clockToConst Realtime = #const CLOCK_REALTIME
clockToConst ProcessCPUTime = #const CLOCK_PROCESS_CPUTIME_ID
clockToConst ThreadCPUTime = #const CLOCK_THREAD_CPUTIME_ID
#endif

#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
Expand Down