Skip to main content
Skip table of contents

19.0 RTC (T7-Pro Only) [T-Series Datasheet]

Overview - T7-Pro Only

The T7-Pro has a battery-backed RTC (real-time clock) which is useful for assigning timestamps to data that is stored on the microSD card during scripting operations—particularly in situations where the device could experience power failure or other reboots, and does not have a communication connection that can be used to determine real-time after reboot. The system time is stored in seconds since 1970, also known as the Epoch and Unix timestamp.

Note: To use the RTC_TIME_S register please update to a firmware version of 1.0297 or higher on the T7. The start of 2021 exposed a new bug in system time functions on the T7, and this subsequently broke the RTC_TIME_S register functionality on firmware versions 1.0292 and earlier.

Battery Life

Typically, the CR2032 battery can be expected to last 12 years. Several factors can influence the expected life including: 

  • Temperatures - Cold temperatures will decrease the battery's life. 

  • Battery age - Batteries naturally discharge as they age. This also has a temperature dependency, but 20% every 10 years is a good rule of thumb. 

  • External Power - When the T7 is powered up the battery is not used to maintain time. This will extend the battery life.

The RTC requires 925 nA to maintain it's time. A typical CR2032 battery has 210 mAH capacity which works out to a life of 25.9 years. We derate our expectations by ~2 to get the above life expectancy.

Reading Time

Read the system time in seconds with address 61500:

Get a simple calendar time representation by reading six consecutive addresses, starting with address 61510:

To time events faster than 1 second apart, it is possible to read the CORE_TIMER (address 61520) and see how it changes from second to second. To access the core timer value in Lua scripts, use the LJ.Tick() function.

Setting Time

Set the system time by writing a new timestamp (in seconds) to address 61504:

To set the T7-Pro's time from a SNTP server, use RTC_SET_TIME_SNTP and SNTP_UPDATE_INTERVAL:


Read the value of the RTC in a Lua script - lua

table = {}

table[1] = 0 --year

table[2] = 0 --month

table[3] = 0 --day

table[4] = 0 --hour

table[5] = 0 --minute

table[6] = 0 --second

table, error = MB.RA(61510, 0, 6)

print(string.format("%04d/%02d/%02d %02d:%02d.%02d", table[1], table[2], table[3], table[4], table[5], table[6]))

>> 2014/10/15 18:55.22

Read the value of the RTC in C/C++ - c++

int LJMError; double newValue; LJMError = LJM_eReadAddress(handle, 61500, 1, &newValue); printf(newValue); //returned value of 1413398998 would correspond with Wed, 15 Oct 2014 18:49:58 GMT

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.