[OSM-dev] osm time format

Brett Henderson brett at bretth.com
Mon Oct 13 21:27:29 BST 2008


On Tue, Oct 14, 2008 at 3:42 AM, Shaun McDonald
<shaun at shaunmcdonald.me.uk> wrote:
> The time will be UK time.
> The +0100 is the difference from UTC.
>
> There is a simple rails setting to make the server use UTC in the bottom of
> config/environment.rb
>
> Shaun
> On 13 Oct 2008, at 16:33, Joachim Zobel wrote:
>
>> Hi.
>>
>> Is there any documentation on the timestamp attribute? If no time zone
>> is given, can I assume it is UTC?

As far as I'm aware all OSM apps specify the time zone.  I believe the
API always has.  Jon Burgess and I agreed on a common format some time
ago between the planet dump and osmosis that explicitly specifies UTC.
 JOSM never used to specify timezone but I submitted a patch a long
time ago to align it with osmosis.

The API specifies time like this with an explicit timezone offset:
timestamp="2008-08-31T10:47:33+01:00"

Osmosis, the planet dump and JOSM specify time like this (Z denotes UTC).
timestamp="2007-10-13T02:04:04Z"

The API MySQL database does not store timezone internally but assumes
the server is running in UK time (BST?) which is either +0 or +1 hour
depending on whether daylight savings is active or not.  Any app
connecting to the API db must run in BST or dates will be read
incorrectly.  In my opinion everything should just use UTC but so long
as all interchange files are explicit then it doesn't really matter.

The other point to remember is that the time format used by osmosis,
the planet dump and JOSM was chosen for speed of parsing.  This is
only important when dealing with huge files.  Osmosis in particular
was spending most of its processing time in date parsing.  With a
fixed UTC time format I have written a custom parser that is much
faster which falls back to a more generic parser if necessary.

It's probably not documented anywhere :-)




More information about the dev mailing list