Fix Date

asiLab2 years ago

Hello,
my device produces date/time based on NMEA sentences so DateTime in not localized but satellite time, so when i see devices on map, in my country for example, realtime is 2 hours back. Is there some parameter i can set in position ti fix it?

How do you handle this, I guess I'm not the first with this problem..?

Regards,
Gian

Anton Tananaev2 years ago

What do you mean by satellite time? UTC? That's exactly what's expected.

asiLab2 years ago

Yes.. UTC.
How can I fix to my local datetime?

BR
Gian

Anton Tananaev2 years ago

If your device is really reporting UTC, it will be automatically converted. Do you have logs showing the problem?

asiLab2 years ago

Just the time to put some system.out in code.. BRB.

asiLab2 years ago
int hours = (int) ((((inputBytes[3] & 0xF0) >> 4) * 10) + (inputBytes[3] & 0x0F));
int minutes = (int) ((((inputBytes[4] & 0xF0) >> 4) * 10) + (inputBytes[4] & 0x0F));
int seconds = (int) ((((inputBytes[5] & 0xF0) >> 4) * 10) + (inputBytes[5] & 0x0F));
int day = (int) ((((inputBytes[0] & 0xF0) >> 4) * 10) + (inputBytes[0] & 0x0F));
int month = (int) ((((inputBytes[1] & 0xF0) >> 4) * 10) + (inputBytes[1] & 0x0F));
int year = (int) ((((inputBytes[2] & 0xF0) >> 4) * 10) + (inputBytes[2] & 0x0F));

Device Sent:27 06 22 23 50 16
Position Time is :Mon Jun 27 23:50:16 CEST 2022

And this is same time i see on web. But at my side it's 01:50.

gian

Anton Tananaev2 years ago

What is this code? This is not what I asked for.

asiLab2 years ago

What kind of log you need? I'm in debug on IntelliJ... You need complete server log?

G.

asiLab2 years ago
2022-06-28 01:50:22  INFO: [Tf37339c9: nventa < 192.168.1.1] 3c522706222350200410149222101429801251000000070100113100000375173e3c522706222350220410149219101429802001000000070100112100000375173e
2022-06-28 01:50:22  INFO: [Tf37339c9] id: 354293067819220, time: 2022-06-27 23:50:16, lat: 41.02386, lon: 14.49655, course: 0.0
2022-06-28 01:50:22  INFO: [Tf37339c9] id: 354293067819220, time: 2022-06-27 23:50:16, lat: 41.02386, lon: 14.49655, course: 0.0
2022-06-28 01:50:24  INFO: [Tf37339c9] disconnected
2022-06-28 01:52:39  INFO: user: 1, action: login
Anton Tananaev2 years ago

There's no such protocol in Traccar. It seems like you're adding your own code.

asiLab2 years ago

Yes.. I'm adding a protocol. I just need to understand how to convert points received from device with time in UTC.. to points traced on web with the correct (local) datetime. Sorry if i'm not been clear enough.

G.

Anton Tananaev2 years ago

It's not clear to me why it's a problem. Pretty much all protocols are expecting UTC time. Just do the same thing.

asiLab2 years ago

Ok... In protocol you receive time in UTC... let say.. it's 10:00 ok?
If i live in Paris.. naturally 10:00 is not my time.. my time is GMT+1 so it will be 11:00 and if there is legal hour it will be 12:00.

It's ok for me that software stores points in DB in UTC, but naturally my user want to see their local times..

Where I can set that USER X is GMT+1 and show hit the right time with LOCALE fixes ??? In other words.. the boy from Paris how get 11:00 and not 10:00?

Hope clear enough...

G.

Anton Tananaev2 years ago

Traccar converts to your local time automatically in the web app. You don't need to do anything for it.

asiLab2 years ago

Ok.. nice.. that's what i need.
Anyway...It's not happening at moment for me.. that's why I asked... but it must be related to debug or other things..

thanks for your patience.

Gian