[PATCH] Use capi for syscalls that break under musl's handling of 64-bit time_t
authorMarios Titas <redneb@gmx.com>
Sun, 2 Oct 2022 20:12:43 +0000 (23:12 +0300)
committerGianfranco Costamagna <locutusofborg@debian.org>
Tue, 5 Nov 2024 23:21:23 +0000 (00:21 +0100)
Gbp-Pq: Name time_t-time

libraries/time/lib/Data/Time/Clock/Internal/CTimespec.hsc
libraries/time/lib/Data/Time/Clock/Internal/CTimeval.hs

index 9b162e6c132a23a38bb9e3b1f6494b2162c9c46f..ee0ad1a5e9ff77f5e293987aa915673720481a78 100644 (file)
@@ -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.
index f9ba659613279ee104800bb1e6cb0e9d1221914e..beb39501a291e8ce6e0679e4f6fbe89aada3a44a 100644 (file)
@@ -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