ntptime.getTimestamp returns incorrect timestamp.
-
version: UIFlow: v1.9.5
code:
text = M5Label('text', x=38, y=137, color=0x000, font=FONT_MONT_30, parent=None)
text2 = M5Label('text', x=38, y=117, color=0x000, font=FONT_MONT_30, parent=None)
ntp = ntptime.client()
ts = ntp.getTimestamp()
year = ntp.year()
month = ntp.month()
day = ntp.day()
text.set_text('%s' % (ts))
text2.set_text('%s-%s-%s' % (year, month, day))expected:
corrected timestamp as now (2022-09-19 ish).
saw: some strange timestamp in around 1992. (716937583)I'm wondering whether this is within expectation?
-
@chhsiao have you set the correct timeszone or tried a different time zone?
1992 would imply that it doesn’t have a valid time click connection -
hi @ajb2k3 ~
Thank you so much for the reply.
the year-month-day (text2) shows expected date-time though.
I would assume that we do have successful ntp connection because of text2.
In my real code, the time-server is set as our internal time-server, and the timezone is set as 0 (for UTC). -

hi @ajb2k3 ~
Thank you so much for the reply.
As you can see from the screenshot:
the year-month-day (text2) shows expected date-time though.
I would assume that we do have successful ntp connection because of text2.
In my real code, the time-server is set as our internal time-server, and the timezone is set as 0 (for UTC). -
Looks like this ntptime timestamp is relative to 01/01/2000, and not to 01/01/1970 like the Epoch Unix timestamp.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login