Realtime clock (RTC) explained

Realtime clock (RTC) behaviour

All RBR instruments incorporate a realtime clock based on UNIX time with an EPOCH of 2000-01-01 00.00.00.000. The RTC counts up from EPOCH in millisecond increments. Set the RTC of the instrument by synchronizing it to a computer; this provides a common reference point to allow proper conversion to realtime.  

While the RTC measures the time in milliseconds, Ruskin converts this value to yyyy-mm-dd hh.mm.ss.ttt. All file types exported by Ruskin follow this timestamp format.


When viewing the data using an SQLite browser, the timestamp is be in milliseconds from EPOCH. 


The clock has a drift of approximately 60 seconds per year. This drift may not be constant or linear, and will get reset every time the RTC is re-synchronised. 


The clock will stop counting shortly after power is removed from the instrument. The RTC of our older instruments will continue to run for about one minute. In comparison, our newer instruments integrate an internal supercapacitor and power the RTC for at least 15 minutes (the actual time may vary between 15 minutes and 12 hours depending on temperature) after the power is removed. Once the supercapacitor discharges, the RTC shuts down and loses synchronisation to the real world. When the power to the instrument is re-established, the instrument will wake up and resume its sampling schedule but will start with its RTC reset to EPOCH (2000-01-01 00.00.00.000). 

Ruskin time manipulation when the clock resets

Every time the RTC loses power, the RTC will reset to EPOCH, and the timestamp will start from January 2000.

The data samples obtained before or after the reset are not lost, and the complete dataset is stored in the memory location. However, an issue arises when plotting the data. 

If the dataset is plotted based on the timestamps, samples taken after the RTC reset will be plotted before previously captured data. For example, earlier samples will be dated June 2021, while newer samples will be appear to be from January 2000.  If multiple RTC resets occur, then numerous data points will be overlapping. To adjust for this, Ruskin plots samples in the order they are captured, moving the second time-series to midnight of the next day in Ruskin.


While the data will look correct after this manipulation, the timestamps after the reset cannot be trusted as it is, usually, unknown how long the instrument remained without power.


When does RTC reset occur?

The most common cause of RTC resetting is dead or dying batteries.  As the temperature of the instrument decreases, so does the electric current the battery can supply.  It is common to see multiple RTC resets towards the end of the battery life.


RTC conversion

https://currentmillis.com/