-
Notifications
You must be signed in to change notification settings - Fork 2
How to correctly set Time zones
Zakaria Braksa edited this page Jul 24, 2015
·
8 revisions
- This is just a little experiment to better illustrate how Traccar server having a time zone different than UTC can make things a mess.
- The difference between the first and second setup is the
time zoneused by the Traccar Server. - Traccar server by the way inherits the system time zone (the server on which it's running when it it's daemon was launched)
- In both examples the
GPS trackertime zone isUTC+2, but it doesn't really matter, it could be anything else. - Also
MySQL DBtime zone in both examples isUTC+3, but it was intentional to illustrate thatMySQL time zonehas no effect.
- GPS Tracker (UTC+2) -> Traccar server (UTC+1) -> MySQL (UTC+3) -> Rails (UTC)
Results
- Time on the GPS Tracked was
21:18:37 UTC+2 - In Traccar logs I got
20:18:37 UTC+1, which make sense, since clearly Traccar translated from UTC+2 to UTC+1 - In MySQL I got
2015-07-24 20:18:37(which is bad since it doesn't include any Timezone information) - And from the Rails console I get
20:18:37 UTC +00:00(since MySQL doesn't keep time zone data with dates)
- GPS Tracker (UTC+2) -> Traccar server (UTC) -> MySQL (UTC+3) -> Rails (UTC)
Results
- Time on the GPS tracker was
21:06 UTC+2 - From Traccar logs it showed up as
19:06 UTC(so clearly Traccar translated it to current system time which is UTC) - From
MySQL databaseI got19:06 - From
Rails consoledatabase it showed up as19:06:00 UTC +00:00(which is correct)
The computer/server on which Traccar server is running should be on UTC.