This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

AT+CCLK returns incorrect time after cellular reconnect

Hi,

I noticed something strange while developing with the nRF9160 modem's RTC. Here's the sequence of events

  1. Connect cellular
  2. Get time from NTP server and initialize modem RTC with it. AT+CCLK="19/12/06,20:20:10+00"
  3. Disconnect cellular
  4. Read time from modem RTC with AT+CCLK? Observe correct time (+CCLK: "19/12/06,20:20:10+00")
  5. Connect cellular
  6. Read time from modem RTC with AT+CCLK? Observe incorrect time. (+CCLK: "19/12/06,20:20:19-20")

It looks like the modem RTC updates the time zone identifier in the datetime string without adjusting the time. This looks like a bug to me. If I see a timezone in a datetime string, I would expect the value displayed to be in local time, not UTC.

This is on modem firmware 1.1.

Best regards,

Jeff

  • Hi Jeff

    The AT+CCLK command returns the GMT time and the difference to your local time in quarters of an hour. So, 20:20:19-20 means that your local time is 20:20 minus 20 quarters (5 hours), so 15:20 (3:20 PM). I agree that this is not an expected way of getting the time, but the documentation states that it is done this way, so it is not a bug. 

    You can check out the modem_info library in order to get the mobile network time and date, as well as a multitude of other information from the modem.

    Best regards,

    Simon

Related