[Haskell-cafe] Re: why doesn't time allow diff of localtimes ?
briand at aracnet.com
briand at aracnet.com
Thu Apr 1 00:34:34 EDT 2010
On Thu, 01 Apr 2010 06:20:25 +0200
Maciej Piechotka <uzytkownik2 at gmail.com> wrote:
> On Wed, 2010-03-31 at 19:29 -0700, briand at aracnet.com wrote:
> > On Wed, 31 Mar 2010 01:32:56 -0400
> > wagnerdm at seas.upenn.edu wrote:
> >
> > > Two values of LocalTime may well be computed with respect to
> > > different timezones, which makes the operation you ask for
> > > dangerous. First convert to UTCTime (with localTimeToUTC), then
> > > compare.
> >
> > that makes sense. unfortunately getting the current timezone to
> > convert to UTC results in the dreaded IO contamination problem...
> >
> > Brian
>
> Hmm. Where do you get the local times from in the first place?
>
read it from a file of course :-)
I think I've got it figured out. it's not too ugly.
One interesting "hole" in the system is that buildTime can return a
LocalTime _or_ a UTCTime. That means the same string used to
generate a time can give you two different times.
It seems as thought it should be restricted to always returning a
UTCTime. If it's going to return a local time it should require an
extra argument of a timezone, shouldn't it ?
Brian
More information about the Haskell-Cafe
mailing list