Time is being saved wrong in MySQL

Sinaloense2 years ago

traccar.xml

<entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
    <entry key='database.url'>jdbc:mysql://ABC/ABC?serverTimezone=UTC&amp;allowPublicKeyRetrieval=true&amp;useSSL=false&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=''</entry>
    <entry key='database.user'>ABC</entry>
    <entry key='database.password'>ABC</entry>
    
    <entry key='web.port'>2053</entry>
    
    <entry key='notificator.types'>traccar,...</entry>
    <entry key='notificator.traccar.key'>ABC</entry>
    
    <entry key='geocoder.enable'>true</entry>
    <entry key='geocoder.type'>nominatim</entry>
    <entry key='geocoder.url'>https://us1.locationiq.com/v1/reverse.php</entry>
    <entry key='geocoder.key'>pk.ABC</entry>
    
    <entry key='time.override'>serverTime</entry>

tracker-server.log

2023-03-06 23:53:58  INFO: Started Server@7a36c83a{STARTING}[10.0.13,sto=0] @12557ms-XXX.XXXXX
2023-03-06 23:54:51  INFO: [Tc8f59eda] connected
2023-03-06 23:54:51  INFO: [Tc8f59eda: gt06 < XXX.XX.XXX.XX] 787811010867946050724802005a000a00568cc30d0a
2023-03-06 23:54:51  INFO: [Tc8f59eda: gt06 > XXX.XX.XXX.XX] 787805010056ffe60d0a
2023-03-06 23:54:53  INFO: [Tc8f59eda: gt06 < XXX.XX.XXX.XX] 78780a13000504000200572e6a0d0a
2023-03-06 23:54:53  INFO: [Tc8f59eda: gt06 > XXX.XX.XXX.XX] 787805130057de420d0a
2023-03-06 23:54:53  INFO: [Tc8f59eda] id: 867946050724802, time: 2023-03-06 23:54:53, lat: XX.XXXXX, lon: -XXX.XXXXX, course: 266.0
2023-03-06 23:56:44  INFO: [Tc8f59eda: gt06 < XXX.XX.XXX.XX] 79790020940a086794605072480203340203142072008952020022221309705f0058d80b0d0a
2023-03-06 23:56:44  INFO: [Tc8f59eda] id: 867946050724802, time: 2023-03-06 23:56:44, lat: XX.XXXXX, lon: -XXX.XXXXX, course: 266.0
2023-03-06 23:59:53  INFO: [Tc8f59eda: gt06 < XXX.XX.XXX.XX] 78780a1300050300020059f7c80d0a
2023-03-06 23:59:53  INFO: [Tc8f59eda: gt06 > XXX.XX.XXX.XX] 787805130059373c0d0a
2023-03-06 23:59:53  INFO: [Tc8f59eda] id: 867946050724802, time: 2023-03-06 23:59:53, lat: XX.XXXXX, lon: -XXX.XXXXX, course: 266.0

table tc_positions
tc_positions

Server preferences
server preferences

The time of my linux is America/Mazatlan (UTC/GMT -7).
The time of my device is GMT 0.
The file "tracker-server.log" has the correct server time and with xml<entry key='time.override'>serverTime</entry> the device time is stored on the log file as the server time, but another time is stored in MySQL table.

Sinaloense2 years ago

Just when I posted this I realized that the server time is set from the connection to the database, it's solved now, sorry.