Type for Current Time Function
Benjamin.Rudiak-Gould at cl.cam.ac.uk
Fri Feb 4 12:36:11 EST 2005
Ashley Yakeley wrote:
>The most basic or at least the most obvious function in a time library
>is one that gets the current time. What is its return type?
> getCurrentTime :: IO ???
The only way to find out the current time is to ask the system for it,
so, following the rule of avoid-unnecessary-conversions, I think it
boils down to what the system provides.
My impression is that it doesn't reliably provide us anything. Therefore
we should omit getCurrentTime from the library. :-)
Or, more pragmatically, have it return OSTime, and provide
broken-by-design conversions from that to everything else. OSTime would
presumably be struct timeval on Unix, and FILETIME or SYSTEMTIME on Win32.
More information about the Libraries