aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions.rsc
diff options
context:
space:
mode:
Diffstat (limited to 'global-functions.rsc')
-rw-r--r--global-functions.rsc18
1 files changed, 10 insertions, 8 deletions
diff --git a/global-functions.rsc b/global-functions.rsc
index 5135fc1..3800ad5 100644
--- a/global-functions.rsc
+++ b/global-functions.rsc
@@ -12,7 +12,7 @@
:local ScriptName [ :jobname ];
# expected configuration version
-:global ExpectedConfigVersion 127;
+:global ExpectedConfigVersion 128;
# global variables not to be changed by user
:global GlobalFunctionsReady false;
@@ -673,7 +673,7 @@
:global IsTimeSyncCached;
:global IsTimeSyncResetNtp;
- :global LogPrint;
+ :global LogPrintOnce;
:if ($IsTimeSyncCached = true) do={
:return true;
@@ -685,14 +685,15 @@
:return true;
}
+ :local Uptime [ /system/resource/get uptime ];
:if ([ :typeof $IsTimeSyncResetNtp ] = "nothing") do={
- :set IsTimeSyncResetNtp 0s;
+ :set IsTimeSyncResetNtp $Uptime;
}
- :local Uptime [ /system/resource/get uptime ];
:if ($Uptime - $IsTimeSyncResetNtp < 3m) do={
:return false;
}
+ $LogPrintOnce warning $0 ("The ntp client is configured, but did not sync.");
:set IsTimeSyncResetNtp $Uptime;
/system/ntp/client/set enabled=no;
:delay 20ms;
@@ -702,7 +703,7 @@
:if ([ /system/license/get ]->"level" = "free" || \
[ /system/resource/get ]->"board-name" = "x86") do={
- $LogPrint debug $0 ("No ntp client configured, relying on RTC for CHR free license and x86.");
+ $LogPrintOnce debug $0 ("No ntp client configured, relying on RTC for CHR free license and x86.");
:return true;
}
@@ -714,7 +715,7 @@
:return false;
}
- $LogPrint debug $0 ("No time source configured! Returning gracefully...");
+ $LogPrintOnce debug $0 ("No time source configured! Returning gracefully...");
:return true;
}
@@ -1517,13 +1518,14 @@
:global CleanFilePath;
:global EitherOr;
+ :global MAX;
:set FileName [ $CleanFilePath $FileName ];
:local I 1;
- :local Delay ([ :totime [ $EitherOr $WaitTime 2s ] ] / 20);
+ :local Delay ([ $MAX [ $EitherOr $WaitTime 2s ] 100ms ] / 10);
:while ([ :len [ /file/find where name=$FileName ] ] = 0) do={
- :if ($I >= 20) do={
+ :if ($I >= 10) do={
:return false;
}
:delay $Delay;