How do you get the data from the database? Are you sure the tool that you use doesn't convert time to local for you? What exactly is the issue? Is something not right?
Hello,
I get the data from Postico App on mac. Have the same problem when I get data from psql client in Linux.
I would like to know if it's normal to have timezoned timestamps in database whereas it's a timestamp without timezone field. And most of all if a tracker is in another country I want to be sure that the timestamp will not be at the country timezone.
It should be fine. Just change your timezone and try it. Why doing this guesswork?
What timezone to change ?
Because I would like to have no any problems when selecting positions in the database from people in other countries.
Devices (almost) always report UTC time, so it doesn't matter where they are. You can test it using Traccar Client with changed timezone on the phone, as an example.
Hello Anton,
I open again this thread because with the time change in France I have a big problem. The fixtimes in the database are still not in UTC but in the local timezone. So it give me problems when I compare dates before and after the time change.
Is it possible to insert utc dates in the database whereas insert timezoned dates ? Maybe I can do it by myself could you please help me by telling me in which source file I can edit this ? :)
Have a good day
Usually databases store time in UTC timezone. How did you determine that your one stores local timezone?
Hello thanks for your answser
As you can see now in France it is 01:45 pm and I have an entry like this :
As you can see the date is not in UTC so this is very annoying for me when I want to use these dates ^^
As I said in a previous message I've got the same date when I use psql client in Linux.
Where does it say that it's not UTC? Sounds like your issue is incorrect time, not incorrect timezone.
It's not UTC because in France it was 01:45 pm (UTC+2) and on the database the last record was at 01:44 pm so UTC+2 instead of UTC.
Yes indeed it's incorrect time because these are timestamps without timezone.
Does your device send UTC time? That's what server expects.
Yes as you can see on my first post ;)
It's very strange maybe java cast it automatically ?
The tool that you are using to get database data is likely returning you local time. It doesn't mean that what's stored in the database is not UTC. I can see that servertime
matches fixtime
which means that time is correct.
But with this tool, psql client on Linux and sequelize with nodejs I have the same result.
Servertime and fixtime can match but if they are not store in UTC I still have the problem.
How do you think I can debug it ?
Thanks for help
Hi everyone and Anton,
I did some research on the forum but I didn't found the answer.
I have a problem with the servertime, devicetime & fixtime on my database. There are all in UTC+1 (good time zone for my location but you said it must be in UTC in the database, and I would prefer to have UTC time).
I've this problem with all the 4 GT06 trackers I have, and with one TK103 tracker also.
I've checked the logs and I see that my TK103 tracker send a good UTC date :
(....N...W000.0110757000.0000000010L00000000)
110757
so 11:07:57
When I check this record on the database I have :
servertime :
2017-12-27 12:08:01.946
devicetime :
2017-12-27 12:07:57
fixtime :
2017-12-27 12:07:57
I don't understand why Traccar "cast" the date into a utc+1 date.
Maybe I have to set my linux in UTC time ? (is in UTC+1 timezone)
Have a good day.