[Haskell-cafe] Converting CTime -> Int

Sven Panne sven.panne at aedion.de
Sun Aug 26 07:34:41 EDT 2007


[ Sorry for the *extremely* slow response, but I'm currently working through 
my backlog of >6000 mails... :-P ]

On Wednesday 16 May 2007 09:35, Tomasz Zielonka wrote:
> I wonder why CTime is not Integral - maybe there is no such guarantee
> for time_t? If so, then you shouldn't rely on Enum. The safest bet seems
> to be toRational - CTime is Real.

The Single Unix Specification has the answer:

http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/types.h.html#tag_13_67

   "time_t and clock_t shall be integer or real-floating types."

CTime's Enum instance is as debatable as the ones for Float and Double, but 
for consistency reasons we included it in the FFI spec.

Cheers,
   S.


More information about the Haskell-Cafe mailing list