Converting GPS timestamp to actual Date / Time

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
simon.schvartzman
Posts: 281
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Converting GPS timestamp to actual Date / Time

Post by simon.schvartzman » Fri Mar 15, 2019 7:13 pm

As I'm a lazy animal before I start a test & try process I would like to check if anybody has already implemented a routine to convert the timestamp returned by the GPS

Code: Select all

   put mobileSensorReading ("location", true) into tDetails
   put tDetails["timestamp"] into ActTimeStamp
 
to the actual Date & Time. (don't care for the time zone for now)

According to the dictionary (point for me Klaus) :
"timestamp": the time at which the measurement was taken, in seconds since 1970.
But it doesn't specify "since when" in 1970, would it be:

January 1, 1970 00:00:01 or
December 31, 1970 23:59:59 or
Nov 6, 1970 11:32 AM (Neptune enters Sagittarius)

Anyone?

Thanks
Simon
________________________________________
To ";" or not to ";" that is the question

Klaus
Posts: 10986
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Converting GPS timestamp to actual Date / Time

Post by Klaus » Fri Mar 15, 2019 7:16 pm

It is: January 1, 1970 00:00:01

simon.schvartzman
Posts: 281
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: Converting GPS timestamp to actual Date / Time

Post by simon.schvartzman » Fri Mar 15, 2019 7:38 pm

Thanks Klaus! As most of the times LC positively surprises me making things really easy...

And the answer is:

Code: Select all

put mobileSensorReading ("location", true) into tDetails
put tDetails["timestamp"] into ActTimeStamp
convert ActTimeStamp from seconds to dateItems
Simon
________________________________________
To ";" or not to ";" that is the question

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6011
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Converting GPS timestamp to actual Date / Time

Post by dunbarx » Fri Mar 15, 2019 8:44 pm

Why limit oneself to the winter after Woodstock?

viewtopic.php?f=9&t=26619&p=138530&hili ... ng#p138530

Craig Newman

Post Reply

Return to “Talking LiveCode”