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).



  • 0_1663857818576_IMG_1182.jpg

    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).