aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--global-functions.rsc11
1 files changed, 6 insertions, 5 deletions
diff --git a/global-functions.rsc b/global-functions.rsc
index bdab5a2..b8da30b 100644
--- a/global-functions.rsc
+++ b/global-functions.rsc
@@ -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;
}