Skip to content

Use capi for syscalls that break under musl's handling of 64-bit time_t #225

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

Merged
merged 1 commit into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions lib/Data/Time/Clock/Internal/CTimespec.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ instance Storable CTimespec where
#{poke struct timespec, tv_sec } p s
#{poke struct timespec, tv_nsec} p ns

foreign import ccall unsafe "time.h clock_gettime"
foreign import capi unsafe "time.h clock_gettime"
clock_gettime :: ClockID -> Ptr CTimespec -> IO CInt
foreign import ccall unsafe "time.h clock_getres"
foreign import capi unsafe "time.h clock_getres"
clock_getres :: ClockID -> Ptr CTimespec -> IO CInt

-- | Get the resolution of the given clock.
Expand Down
3 changes: 2 additions & 1 deletion lib/Data/Time/Clock/Internal/CTimeval.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE Safe #-}
{-# LANGUAGE CApiFFI #-}

module Data.Time.Clock.Internal.CTimeval where

Expand All @@ -23,7 +24,7 @@ instance Storable CTimeval where
pokeElemOff (castPtr p) 0 s
pokeElemOff (castPtr p) 1 mus

foreign import ccall unsafe "time.h gettimeofday" gettimeofday :: Ptr CTimeval -> Ptr () -> IO CInt
foreign import capi unsafe "sys/time.h gettimeofday" gettimeofday :: Ptr CTimeval -> Ptr () -> IO CInt

-- | Get the current POSIX time from the system clock.
getCTimeval :: IO CTimeval
Expand Down