Skip to content

Use CApiFFI for syscalls that break with glibc's handling of 64-bit time_t #16

New issue

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

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

Already on GitHub? # to your account

Open
iliastsi opened this issue Apr 19, 2024 · 0 comments

Comments

@iliastsi
Copy link

As part of the effort to support 64-bit time_t on 32-bit platforms, glibc uses macros to define functions like clock_gettime(), time(), mktime(), localtime() etc. This breaks old-time which uses the ccall calling convention.

As an example, the following code breaks on a 32-bit system with 64-bit time_t:

import System.Time

main = do
  let clock = TOD 3000000000 0
  let utc = toUTCTime clock
  print $ show clock
  print $ show $ toClockTime utc

output:

"Sat Jan 24 05:20:00 UTC 2065"
"Sun Feb  7 06:28:15 UTC 2106"

Here are some related fixes on other Haskell libraries:

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant