Logic Machine Forum
Synchronize the system clock time - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Synchronize the system clock time (/showthread.php?tid=878)



Synchronize the system clock time - Benjamin - 30.06.2017

Unfortunately, I have no sync with NTP Server.


Is it possible to change the system clock time from a group address?


RE: Synchronize the system clock time - admin - 30.06.2017

See this example:
http://openrb.com/example-change-timedate-from-lua-script-on-lm2/


RE: Synchronize the system clock time - Benjamin - 05.07.2017

(30.06.2017, 12:22)admin Wrote: See this example:
http://openrb.com/example-change-timedate-from-lua-script-on-lm2/

I have tried it with this example but there is a problem.

If the group address sends the time, this is also accepted by the system.

But the clock does not continue in the system and stops.


RE: Synchronize the system clock time - admin - 05.07.2017

What do you mean that the clock stops?


RE: Synchronize the system clock time - Benjamin - 07.07.2017

Sorry.

I have found my error.

This is not a resident script!! This is a Event-Based script

date = grp.getvalue('date_object')
time = grp.getvalue('time_object')

cmd = string.format("date -s '%d-%d-%d %d:%d:%d'", date.year, date.month, date.day, time.hour, time.minute, time.second)
os.execute(cmd)