couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Will Heger <>
Subject Re: map timezones
Date Thu, 07 Mar 2013 05:24:07 GMT

> What’s “local time”? The time zone of the server? A map/reduce function
> has to be a “pure” function, so it can’t depend on any external inputs
> that might change, such as the current timezone.

Well, this was very much my point.  I'm not interested in server locale or
a Date() time, I'm interested in the absolute time stamped on my docs by
clients.  I just want to use it in conjunction with location so my maps can
report local time.

We are missing the following library for our views:

In that way, as a developer I can store times within my document using
either UTC or epoch times.  These times could be current or historical, it
doesn't matter.  What matters is that they're unambiguous. And there exists
a pure function F such that:
 F(doc.epoch_time, doc.location) = A time for that locale for that moment
in history

Absent this, I think the best idea is to store the epoch time and force the
client to also stamp the relevant local UTC offset.  It offers the most
flexibility in terms of reporting, deals with DST weirdness, and I have
more resources to look-up UTC offsets from client code than in couch.

Thanks for letting me rubber duck this, I hope this strategy helps someone

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message