diff options
author | Christian Hesse <mail@eworm.de> | 2022-07-21 13:36:37 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2022-07-21 14:04:44 +0200 |
commit | 82f27268b3800cf11cc7f53802a70ecd87d82f06 (patch) | |
tree | e1ba2ba113b86d7ab1eacd74d1c3ecfb58a6551a /global-functions | |
parent | 329e606b9366ce81da09c6f36f68edc4c8c98384 (diff) |
global-functions: $IsTimeSync: cache a positive result
The functions do not rely on perfectly synced time. About the right time
is fine, that should make sure certificates are valid and mails are sent
with reasonable headers. So cache the result if system is fine for later
use.
Diffstat (limited to 'global-functions')
-rw-r--r-- | global-functions | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/global-functions b/global-functions index cfec740..8d44957 100644 --- a/global-functions +++ b/global-functions @@ -481,10 +481,17 @@ # check if system time is sync :set IsTimeSync do={ + :global IsTimeSyncCached; + :global LogPrintExit2; + :if ($IsTimeSyncCached = true) do={ + :return true; + } + :if ([ /system/ntp/client/get enabled ] = true) do={ :if ([ /system/ntp/client/get status ] = "synchronized") do={ + :set IsTimeSyncCached true; :return true; } :return false; @@ -492,6 +499,7 @@ :if ([ /ip/cloud/get update-time ] = true) do={ :if ([ :typeof [ /ip/cloud/get public-address ] ] = "ip") do={ + :set IsTimeSyncCached true; :return true; } :return false; |