pulkin / micropython

MicroPython implementation on Ai-Thinker GPRS module A9 (RDA8955)
https://micropython.org
MIT License
102 stars 30 forks source link

time.time() and gps.time() explanation #71

Open kindmartin opened 4 years ago

kindmartin commented 4 years ago

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 commented 4 years ago

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

bokolob commented 4 years ago

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

pulkin commented 4 years ago

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.