micropython icon indicating copy to clipboard operation
micropython copied to clipboard

time.time() and gps.time() explanation

Open kindmartin opened this issue 5 years ago • 3 comments

Hi all here, im relatively new in micropython coding and im not sure how to manage to have a current time set in the board when it boots.

time.time() give datatimes values near 2050..

time.localtime(time.time()) (2047, 1, 1, 10, 14, 39, 1, 1) time.time() 1483265755

and gps.time() worst.

gps.get_firmware_version() ',GOKE9501_1.4_18022400,GOKE microsemi' gps.time() 2525040637 thats as the seconds are even bigger localtime would return overruns.

any hint?

kindmartin avatar Aug 22 '20 03:08 kindmartin

wait for right gps.time() or use ntptime? ntptime.settime() ?

kindmartin avatar Aug 22 '20 06:08 kindmartin

I’ve noticed that gps gives time near 2050 when it doesn’t see satellites

bokolob avatar Sep 15 '20 06:09 bokolob

As far as I remember, gps starts with reporting year 1980. Micropython cannot handle anything before 2000 so it should report 2080 or something. time.time outputs network time. If there is a bug there I will need more information.

pulkin avatar Sep 15 '20 09:09 pulkin