Hi all
The plot thickens! I decided to take myT DateTime value, produced from the gps date and time. I first checked it by converting it back to a string and all was well.
I then used DateTimeToUnix to give me the number of seconds elapsed since the date in 1970.
I then used UnixToDateTime to get back to a TDateTime, converted this to a string and lo and behold, it had lost about 29 hours!!!
I then tried adding that number of seconds to the int64 epoch value. This got it near but the difference varies each time you run the program!!
It thus appears that DateTimeToUnix and its reverse are worse than useless!
Here is the code:
//set RasPi's time and date from $GPRMC
dateString := GPSList.Strings[9];
timeString := GPSList.Strings[1];
t := EncodeDateTime(StrToInt(MidStr(dateString, 5,6)),StrToInt(MidStr(dateString,3,2)),StrToInt(MidStr(dateString,1,2)),StrToInt(LeftStr(timeString,2)),StrToInt(MidStr(timeString,3,2)),StrToInt(MidStr(timeString,5,2)),0);
//t checks as correct
//ee is an int64
ee := DateTimeToUnix(t);
//correction
ee := ee + 63114015200;
ST := UnixToDateTime(ee);
DateTimeToString(G, 'hh:mm:ss DD/MM/YY', ST);
j := FormatDateTime('hh:mm:ss', Now);
//variable difference between G and j!
Label5.Caption := G + ', ' + j;
This is getting silly!
Brian