Fix time as UTC

Richard Creer6 years ago

As far as I can see fix time is being stored as local time when using a MySQL database. Here is the evidence:

From Traccar log

2019-04-11 12:57:35  INFO: [e3fd4578: 5055 < 62.3.226.214] HEX: 504f5354202f3f69643d3634353731342674696d657374616d703d31353534393833383439266c61743d35302e38343036393836266c6f6e3d2d302e393330353036312673706565643d302e302662656172696e673d302e3026616c7469747564653d35372e302661636375726163793d352e39333539393938373033303032393326626174743d3130302e3020485454502f312e310d0a436f6e74656e742d547970653a206170706c69636174696f6e2f782d7777772d666f726d2d75726c656e636f6465640d0a557365722d4167656e743a2044616c76696b2f322e312e3020284c696e75783b20553b20416e64726f696420382e302e303b204f4e45504c5553204133303033204275696c642f4f5052312e3137303632332e303332290d0a486f73743a2036322e332e3232362e3231343a353035350d0a436f6e6e656374696f6e3a204b6565702d416c6976650d0a4163636570742d456e636f64696e673a20677a69700d0a436f6e74656e742d4c656e6774683a20300d0a0d0a
2019-04-11 12:57:35  INFO: [e3fd4578: 5055 > 62.3.226.214] HEX: 485454502f312e3120323030204f4b0d0a636f6e74656e742d6c656e6774683a20300d0a0d0a
2019-04-11 12:57:35  INFO: [e3fd4578] id: 645714, time: 2019-04-11 12:57:29, lat: 50.84070, lon: -0.93051, course: 0.0, accuracy: 5.9

Equivalent MySQL log

INSERT INTO tc_positions (address, network, serverTime, course, attributes, deviceTime, protocol, longitude, deviceId, latitude, valid, fixTime, speed, altitude, accuracy) VALUES (null, 'null', '2019-04-11 12:57:35.489', 0.0, '{"batteryLevel":100.0,"distance":0.1,"totalDistance":7890.03,"motion":false}', '2019-04-11 12:57:29', 'osmand', -0.9305061, 43, 50.8406986, 1, '2019-04-11 12:57:29', 0.0, 57.0, 5.935999870300293)

UPDATE tc_devices SET positionId = 168 WHERE id = 43

Traccar hex decoded

POST /?id=645714×tamp=1554983849&lat=50.8406986&lon=-0.930561&speed=0.0&bearing=0.0&altitude=57.0&accuracy=5.935999870300293&batt=100.0 HTTP/1.1
Content-Type: application/x-www-form-urlecoded
User-Agent: Dalvik/2.1.0 (Linux; U; Android 8.0.0; ONEPLUS A3003 Build/OPR1.170623.032)
Host: 62.3.226.214:5055
Connect	on: Keep-Alive
Accept-Encoding: gzip
Content-Length: 0

Time stamp = 1554983849 = 2019-04-11 11:57:29 (epochconverter.com)

Should not the time in the MySQL query be the UTC time rather than +1 hour (BST)?

Traccar 4.3, Windows 7 & Windows Server 2012 R2