Opta real time clock

Does anyone have any information on how to read and set the real time clock on the Arduino Opta PLC please?

I've seen two variables:
sysTimer
sysTimerHiRes are these anything to do with the RTC?

Hello @MarkWigley,

Take a look in the RTC section of Opta's User manual; there is an example of how to set Opta's RTC using an NTP server. Let me know if this helps!

Hello @jabagur

Thank you for your help.
With your help I managed to get it to work!

I wanted to set the Opta PLC RTC from a Unix Epoch Time. ie 1701633230

set_time(1701633230); // This set the PLC RTC.

I then needed to extract just the Hours and Minutes.

    time_t t = time(NULL);
    struct tm * ptm;
    ptm = gmtime ( &t );

    ptm->tm_hour;
    ptm->tm_min;

Thank you
@MarkWigley

3 Likes