Type for Current Time Function
simonmar at microsoft.com
Fri Feb 4 10:10:40 EST 2005
On 04 February 2005 12:03, Bayley, Alistair wrote:
>> From: Ashley Yakeley [mailto:ashley at semantic.org]
>> 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 ???
> It looks as though POSIX should be avoided, so I vote for (days,
> ticks). Is there some reason it couldn't (shouldn't) be an opaque
> type? i.e. with functions to convert to-and-from:
> - (days, ticks)
> - seconds since epoch
> - Calendar Time (in various calendars and timezones, etc)
> - other arbitrary representations
I think I don't really understand the (days,ticks) representation.
Could somebody explain the meaning of arithmetic on this type?
Is the ticks field supposed to be limited to a day's worth? Or a day +
a leap second?
Can I add ticks to a time? If so, don't you need leap second info to do
the normalisation? Or, if normalisation doesn't happen, you need leap
second info to convert to UTC, right? The only conclusion seems to be
that either you can't add ticks to a time, or you need leap second info
which is what we're trying to avoid.
Perhaps I missed something... :-S
More information about the Libraries