Dieterbe / anthracite

an event / change logging/managament app
Apache License 2.0
296 stars 33 forks source link

Timezone config question #17

Open wyyang opened 10 years ago

wyyang commented 10 years ago

Hi,

My server timezone is set at UTC, and my browser is PST. No matter if I set timezone="America/Los_Angeles" or timezone="Etc/UTC" in the config.py file, when I tried to add an event via the web interface, it will just add my local PST time to elastic search, unconverted.

Where else shall I look for changes?

Thanks

Weiyi

Dieterbe commented 10 years ago

can you open a python2 session on your terminal, and see how the local_datepick_to_unix_timestamp function behaves? i.e. the one at https://github.com/Dieterbe/anthracite/blob/master/anthracite-web.py#L187

looks like somehow python is not aware of your TZ, and assumes you're in UTC or something you can also add some prints there to see what happens to the data

wyyang commented 10 years ago

On the server side the system time is already set at UTC. Appearently it does not do any zone conversion

local_datepick_to_unix_timestamp("01/02/2013 11:22:33 PM") 1357168953 Is exactly 01/02/2013 11:22:33 PM.

How do I fix that? How can I let the server side python know that my desktop browser is at Pacific time, or force it to think all data it receives is Pacific time that needs to be converted to UTC, and do it cleanly instead of hard coding in anthracite-web.py#L187?

Dieterbe commented 10 years ago

you should haven't to hardcode anything in anthracite-web.py it should respect the timezone you have in your config.py i don't think we do anything with the timezone from the browser (this seems useful to support, although sometimes people have their browser TZ configured badly I think). I don't have much time nowadays so you might want to do some researching yourself :)

blalor commented 9 years ago

This is a raw event in ES that was created with Anthracite:

{
  "_index": "anthracite",
  "_type": "event",
  "_id": "AUrj3ciFZGZGaKAnf1Gk",
  "_score": null,
  "_source": {
    "date": "2015-01-13T10:15:41",
    "desc": "created 01/13/2015 10:15:41 AM",
    "tags": [
      "anthracite_debug"
    ]
  },
  "sort": [
    1421144141000,
    1421144141000
  ]
}

This is with Anthracite's TZ set to UTC. It's not storing the date in ES with the timezone.