Proposal: Add CUSeconds, CSUSeconds to Foreign.C.Types, and fix definition of CTimeval

Hi all, This is a proposal to add CUSeconds, CSUSeconds to Foreign.C.Types (which are Haskell versions of the C useconds_t and suseconds_t types), and fix the definition of CTimeval to use CTime and CSUSeconds rather than CLong. The C types are specified here: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/time.h.html This will fix a bug in getCPUTime on OS X. Patches, from William Knop, to implement this are here: http://hackage.haskell.org/trac/ghc/attachment/ticket/4970/0001-Add-Haskell-... http://hackage.haskell.org/trac/ghc/attachment/ticket/4970/0002-Whitespace-o... http://hackage.haskell.org/trac/ghc/attachment/ticket/4970/0003-Use-CSUSecon... http://hackage.haskell.org/trac/ghc/attachment/ticket/4970/0001-Use-CSUSecon... Discussion deadline: 7 May 2011 Thanks Ian

On Fri, Apr 22, 2011 at 3:25 PM, Ian Lynagh
Hi all,
This is a proposal to add CUSeconds, CSUSeconds to Foreign.C.Types (which are Haskell versions of the C useconds_t and suseconds_t types), and fix the definition of CTimeval to use CTime and CSUSeconds rather than CLong.
The C types are specified here: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/time.h.html
This will fix a bug in getCPUTime on OS X.
Patches, from William Knop, to implement this are here: http://hackage.haskell.org/trac/ghc/attachment/ticket/4970/0001-Add-Haskell-... http://hackage.haskell.org/trac/ghc/attachment/ticket/4970/0002-Whitespace-o... http://hackage.haskell.org/trac/ghc/attachment/ticket/4970/0003-Use-CSUSecon... http://hackage.haskell.org/trac/ghc/attachment/ticket/4970/0001-Use-CSUSecon...
+1 on this, it looks like the right way to fix the bug. Does this work on Windows? These random internet threads raise some doubt: http://www.gossamer-threads.com/lists/mythtv/users/305958 http://www.mail-archive.com/bug-gnulib@gnu.org/msg06957.html And this person has had trouble on the 'Interix' platform, which is the NT unix compat layer (perhaps completely unrelated to mingw?): http://www.mail-archive.com/autoconf@gnu.org/msg16677.html Antoine
Discussion deadline: 7 May 2011
Thanks Ian
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

+1 looks fine.
On Fri, Apr 22, 2011 at 3:21 PM, Antoine Latter
On Fri, Apr 22, 2011 at 3:25 PM, Ian Lynagh
wrote: Hi all,
This is a proposal to add CUSeconds, CSUSeconds to Foreign.C.Types (which are Haskell versions of the C useconds_t and suseconds_t types), and fix the definition of CTimeval to use CTime and CSUSeconds rather than CLong.
The C types are specified here: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/time.h.html
This will fix a bug in getCPUTime on OS X.
Patches, from William Knop, to implement this are here: http://hackage.haskell.org/trac/ghc/attachment/ticket/4970/0001-Add-Haskell-... http://hackage.haskell.org/trac/ghc/attachment/ticket/4970/0002-Whitespace-o... http://hackage.haskell.org/trac/ghc/attachment/ticket/4970/0003-Use-CSUSecon... http://hackage.haskell.org/trac/ghc/attachment/ticket/4970/0001-Use-CSUSecon...
+1 on this, it looks like the right way to fix the bug.
Does this work on Windows? These random internet threads raise some doubt:
http://www.gossamer-threads.com/lists/mythtv/users/305958 http://www.mail-archive.com/bug-gnulib@gnu.org/msg06957.html
And this person has had trouble on the 'Interix' platform, which is the NT unix compat layer (perhaps completely unrelated to mingw?):
http://www.mail-archive.com/autoconf@gnu.org/msg16677.html
Antoine
Discussion deadline: 7 May 2011
Thanks Ian
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

On Fri, Apr 22, 2011 at 05:21:51PM -0500, Antoine Latter wrote:
Does this work on Windows?
I haven't tried yet, but presumably either it will Just Work, or defining it to be (a newtype of, probably) CLong on Windows is the right thing to do. Thanks Ian

+1
It would also be great if CTimeval could be exported from somewhere.
It is already being used in the event manager, the time package and
yesterday Johan Dobbelstein send me a patch to add it to usb:
https://github.com/basvandijk/usb/blob/async/Timeval.hs
Would Foreign.C.Types be a good place to export it from?
Bas
On 22 April 2011 22:25, Ian Lynagh
Hi all,
This is a proposal to add CUSeconds, CSUSeconds to Foreign.C.Types (which are Haskell versions of the C useconds_t and suseconds_t types), and fix the definition of CTimeval to use CTime and CSUSeconds rather than CLong.
The C types are specified here: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/time.h.html
This will fix a bug in getCPUTime on OS X.
Patches, from William Knop, to implement this are here: http://hackage.haskell.org/trac/ghc/attachment/ticket/4970/0001-Add-Haskell-... http://hackage.haskell.org/trac/ghc/attachment/ticket/4970/0002-Whitespace-o... http://hackage.haskell.org/trac/ghc/attachment/ticket/4970/0003-Use-CSUSecon... http://hackage.haskell.org/trac/ghc/attachment/ticket/4970/0001-Use-CSUSecon...
Discussion deadline: 7 May 2011
Thanks Ian
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
participants (4)
-
Antoine Latter
-
Bas van Dijk
-
Don Stewart
-
Ian Lynagh