mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
global-functions: $IsTimeSync: calculate with uptime, drop scheduler
This commit is contained in:
parent
ec7adcf78e
commit
640b8fd401
1 changed files with 6 additions and 5 deletions
|
@ -518,17 +518,18 @@
|
|||
:return true;
|
||||
}
|
||||
|
||||
:if ([ /system/resource/get uptime ] < 3m || $IsTimeSyncResetNtp = true) do={
|
||||
:if ([ :typeof $IsTimeSyncResetNtp ] = "nothing") do={
|
||||
:set IsTimeSyncResetNtp 0s;
|
||||
}
|
||||
:local Uptime [ /system/resource/get uptime ];
|
||||
:if ($Uptime - $IsTimeSyncResetNtp < 3m) do={
|
||||
:return false;
|
||||
}
|
||||
|
||||
:set IsTimeSyncResetNtp true;
|
||||
:set IsTimeSyncResetNtp $Uptime;
|
||||
/system/ntp/client/set enabled=no;
|
||||
:delay 20ms;
|
||||
/system/ntp/client/set enabled=yes;
|
||||
/system/scheduler/add name="clear-IsTimeSyncResetNtp" interval=1m \
|
||||
on-event=("/system/scheduler/remove clear-IsTimeSyncResetNtp; " . \
|
||||
":global IsTimeSyncResetNtp; :set IsTimeSyncResetNtp;");
|
||||
:return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue