Skip to content

Commit

Permalink
TimeVal's members are 64 bit, per the unix package
Browse files Browse the repository at this point in the history
  • Loading branch information
geekosaur committed Apr 16, 2024
1 parent bc6c51e commit 6e3c5df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Graphics/X11/Xlib/Event.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import Data.Data
#endif

#include "HsXlib.h"
#include <sys/time.h>

{-# CFILES cbits/fdset.c #-}

Expand Down Expand Up @@ -398,7 +399,7 @@ get_ConfigureEvent p = peekXConfigureEvent (castPtr p)
-- Returns True if timeout occurs.
waitForEvent :: Display -> Word32 -> IO Bool
waitForEvent display usecs =
with (TimeVal (usecs `div` 1000000) (usecs `mod` 1000000)) $ \ tv_ptr ->
with (TimeVal (fromIntegral usecs `div` 1000000) (fromIntegral usecs `mod` 1000000)) $ \ tv_ptr ->
allocaBytes #{size fd_set} $ \ readfds ->
allocaBytes #{size fd_set} $ \ nofds -> do
let fd = connectionNumber display
Expand Down Expand Up @@ -429,7 +430,7 @@ gettimeofday_in_milliseconds =
TimeVal sec usec <- peek tv_ptr
return (toInteger sec * 1000 + toInteger usec `div` 1000)

data TimeVal = TimeVal Word32 Word32
data TimeVal = TimeVal CLong CLong

instance Storable TimeVal where
alignment _ = #{size int}
Expand Down
2 changes: 1 addition & 1 deletion X11.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: X11
version: 1.10.3.9
version: 1.10.3.10
synopsis: A binding to the X11 graphics library
description: A Haskell binding to the X11 graphics library. The binding is a direct
translation of the C binding; for documentation of these calls, refer
Expand Down

0 comments on commit 6e3c5df

Please sign in to comment.