Open Oscar-Chung-CKL opened 2 years ago
This is a requirement out of scope of Tinygpsplus.
You need a separate library or OS function to handle timezones and to convert times local <-> UTC(GPS). And taking care of leap seconds.
`
TimeChangeRule CEST = {"", Last, Sun, Mar, 2, 120}; // Europa timezone TimeChangeRule CET = {"", Last, Sun, Oct, 3, 60}; Timezone CE(CEST, CET); TimeChangeRule *tcr;
CODE .... CODE
//if (gps.time.isValid()) // BUG in TinyGPS++ if (gps.date.month()>0) {
setTime(gps.time.hour() , gps.time.minute(), gps.time.second() , gps.date.day(), gps.date.month(), gps.date.year());
time_t cet=CE.toLocal(now(),&tcr); // Zeiger auf Zeitzone
setTime(cet); // auf MEZ / MESZ umschalten
}
`
NMEA sentence nZDA is supposed to give you time zone information.
information: ZDA
Descripiton: Time and date information.
Type: Output
Format: $--ZDA,UTCtime,day,month,year,ltzh,ltznCS
Use the following to extract the information.
TinyGPSCustom LocalTimeZoneHour(gps, "GPZDA", 5);
TinyGPSCustom LocalTimeZoneMinute(gps, "GPZDA", 6);
Those will give you the offset in hours and minutes from UTC
after a year, what are you talking about?
I know it's a year later, but the internet is forever.
Someone else is bound to have a similar question.
I was unaware until today that the NMEA sentence GPZDA has the local timezone offset in it.
I plan to use this myself.
To make it work you need to use "whole constellation", thus use command GNZDA
TinyGPSCustom zHour(gps, "GNZDA", 5);
TinyGPSCustom zMinute(gps, "GNZDA", 6);
Anyway in my case it outputs 00:00 although I'm in GMT+1
Anyway in my case it outputs 00:00 although I'm in GMT+1
That's what I got too. I think only certain GPS devices can interpret the offset information, and the rest output 0 all the time.
i have download the library and i am using the neo-6m module on Arduino
I am able to get the time and the gps location, but the time is not the time in my timezone, may i know how can i solve the issue so that i can get the correct time of my time zone ?