From 48878289996b395637bcfc54346d1b22d774d538 Mon Sep 17 00:00:00 2001 From: Marios Titas Date: Sun, 2 Oct 2022 23:12:43 +0300 Subject: [PATCH] [PATCH] Use capi for syscalls that break under musl's handling of 64-bit time_t Gbp-Pq: Name time_t-time --- libraries/time/lib/Data/Time/Clock/Internal/CTimespec.hsc | 4 ++-- libraries/time/lib/Data/Time/Clock/Internal/CTimeval.hs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libraries/time/lib/Data/Time/Clock/Internal/CTimespec.hsc b/libraries/time/lib/Data/Time/Clock/Internal/CTimespec.hsc index 9b162e6c..ee0ad1a5 100644 --- a/libraries/time/lib/Data/Time/Clock/Internal/CTimespec.hsc +++ b/libraries/time/lib/Data/Time/Clock/Internal/CTimespec.hsc @@ -27,9 +27,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. diff --git a/libraries/time/lib/Data/Time/Clock/Internal/CTimeval.hs b/libraries/time/lib/Data/Time/Clock/Internal/CTimeval.hs index f9ba6596..beb39501 100644 --- a/libraries/time/lib/Data/Time/Clock/Internal/CTimeval.hs +++ b/libraries/time/lib/Data/Time/Clock/Internal/CTimeval.hs @@ -1,5 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} +{-# LANGUAGE CApiFFI #-} module Data.Time.Clock.Internal.CTimeval where @@ -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 -- 2.30.2