From 8183e05b97ce870dd6582a3677cc82459ae566ec Mon Sep 17 00:00:00 2001
From: Tomas Janousek <tomi@nomi.cz>
Date: Tue, 30 Apr 2024 18:14:30 +0200
Subject: [PATCH] Fix CTimeVal definition for platforms where time_t isn't
 CLong

One such platform is Debian unstable armhf, which is in the process of
transitioning to 64-bit time_t: https://wiki.debian.org/ReleaseGoals/64bit-time

On that platform (as well as any other glibc/musl platform), however,
CTimeVal isn't used for anything at all because there are #ifdefs that
prefer using `utimensat` which takes CTimeSpec instead. This fix is
therefore quite theoretical, as it is unknown whether there are any
platforms actually affected.

Related: https://github.com/haskell/unix/pull/252
---
 System/Posix/Files/Common.hsc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/System/Posix/Files/Common.hsc b/System/Posix/Files/Common.hsc
index 1f44f7d..feeb915 100644
--- a/System/Posix/Files/Common.hsc
+++ b/System/Posix/Files/Common.hsc
@@ -551,7 +551,7 @@ foreign import capi unsafe "sys/stat.h futimens"
     c_futimens :: CInt -> Ptr CTimeSpec -> IO CInt
 #endif
 
-data CTimeVal = CTimeVal CLong CLong
+data CTimeVal = CTimeVal (#type time_t) (#type suseconds_t)
 
 instance Storable CTimeVal where
     sizeOf    _ = #size struct timeval
-- 
GitLab