Server Time out by 2 hours

Mark Bailey 5 years ago

I have Traccar on a server where the machine has time set to Berlin (UTC + 1)
The Time on the server is 10:00 am
But the servertime in tc_positions says 08:00

Is there any way I can get traccar to read the correct Server Time please.

Anton Tananaev 5 years ago

What's the time in the logs (both position and log entry)? What protocol are you using?

Lukasz 5 years ago

It is summer time in Berlin until 25.10.2020 (+2h).
https://24timezones.com/current_time/germany_berlin_clock.php

Mark Bailey 5 years ago

Here is the log.... which is reflecting the precise Server Time ... 3:05

2020-10-06 03:05:26  INFO: [6b1e9aa2: osmand < 80.187.82.93] HEX: 504f5354202f3f69643d3232393632392674696d657374616d703d31363031393436333236266c61743d35302e393737323131266c6f6e3d372e303133383236322673706565643d32312e3839373736363637313030393036322662656172696e673d3134372e393237343539373136373936383826616c7469747564653d35312e312661636375726163793d332e3930303030303039353336373433313626626174743d3130302e3020485454502f312e310d0a436f6e74656e742d547970653a206170706c69636174696f6e2f782d7777772d666f726d2d75726c656e636f6465640d0a557365722d4167656e743a2044616c76696b2f322e312e3020284c696e75783b20553b20416e64726f696420393b20425639313030204275696c642f505052312e3138303631302e303131290d0a486f73743a206770732d636c69656e742e68656c726f6d2e636f6d3a353035350d0a436f6e6e656374696f6e3a204b6565702d416c6976650d0a4163636570742d456e636f64696e673a20677a69700d0a436f6e74656e742d4c656e6774683a20300d0a0d0a
2020-10-06 03:05:26  INFO: [6b1e9aa2: osmand > 80.187.82.93] HEX: 485454502f312e3120323030204f4b0d0a636f6e74656e742d6c656e6774683a20300d0a0d0a
2020-10-06 03:05:26  INFO: [6b1e9aa2] id: 229629, time: 2020-10-06 03:05:26, lat: 50.97721, lon: 7.01383, speed: 21.9, course: 147.9, accuracy: 3.9

Here is Positions from DB

Servertime: 2020-10-06 01:05:26
Devicetime: 2020-10-06 01:05:26
Fixtime: 2020-10-06 01:05:26

I have tried adding this to my traccar.xml config file...
I am using osmand protocol.

<entry key='gt06.enable'>true</entry>
<entry key='gt06.port'>5055</entry>
<entry key='gt06.timezone'>7200</entry>

But using that port 5055.... both of my devices disconnect.
If I comment out the the port line <!-- <entry key='gt06.port'>5055</entry> -->
then they reconnect ok.

Anton Tananaev 5 years ago

Looks like some database issue.

Mark Bailey 5 years ago

I see. Any suggestions of where and what to look for Anton?

Anton Tananaev 5 years ago

What database are you using?

Mark Bailey 5 years ago

MariaDB

Anton Tananaev 5 years ago

I'm sure there's plenty of documentation available for MariaDB.

Mark Bailey 5 years ago

I guess.... But I cannot begin to think what to even look for

Anton Tananaev 5 years ago

Some ideas to start:

  1. Check database timezone, if there is such thing.
  2. Check URL parameters.
Mark Bailey 5 years ago

Setting the database timezone... for which SELECT Now() returns the correct time does not make any difference.
Traccar DB still recording positions 2 hours early.

I guess I will just have to deal with it by code in my app

Lukasz 5 years ago

In the traccar settings you have:

serverTimezone=UTC

or

serverTimezone=CET

?
If UTC change it to CET. Then check new records.

Lukasz

Mark Bailey 5 years ago

Sorry for the dumb question Lukasz... but were does that go?

In my traccar.xml?
Like this?

<entry key='serverTimezone'>CET</entry>

Lukasz 5 years ago

In traccar.xml

 <entry key='database.url'>jdbc:mysql://xxxxx/Traccar?serverTimezone=CET&amp;useSSL=false&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=''</entry>

Lukasz