aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions.rsc
diff options
context:
space:
mode:
Diffstat (limited to 'global-functions.rsc')
-rw-r--r--global-functions.rsc22
1 files changed, 12 insertions, 10 deletions
diff --git a/global-functions.rsc b/global-functions.rsc
index 5135fc1..eb700ef 100644
--- a/global-functions.rsc
+++ b/global-functions.rsc
@@ -12,7 +12,7 @@
:local ScriptName [ :jobname ];
# expected configuration version
-:global ExpectedConfigVersion 127;
+:global ExpectedConfigVersion 129;
# global variables not to be changed by user
:global GlobalFunctionsReady false;
@@ -229,7 +229,7 @@
:for I from=0 to=([ :len $Input ] - 1) do={
:local Char [ :pick $Input $I ];
- :if ([ :typeof [ find "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-" $Char ] ] = "nil") do={
+ :if ([ :typeof [ find "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" $Char ] ] = "nil") do={
:do {
:if ([ :len $Return ] = 0) do={
:error true;
@@ -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;
}
@@ -998,7 +999,7 @@
:global SymbolForNotification;
:global ValidateSyntax;
- :if ([ $CertificateAvailable "E1" ] = false) do={
+ :if ([ $CertificateAvailable "E5" ] = false) do={
$LogPrint warning $0 ("Downloading certificate failed, trying without.");
}
@@ -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;