mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-11-20 23:02:25 +03:00
fix: ntp should only cache no error result
This commit is contained in:
1 parent
816baefa11
commit
e2e7ca9917
1 file changed
+5
-3
@@ -27,9 +27,11 @@ func IsDatetimeSynced() (ok bool, t time.Time, err error) {
|
||||
return ntpSyncCache.value, ntpSyncCache.realTime, nil
|
||||
}
|
||||
defer func() {
|
||||
ntpSyncCache.value = ok
|
||||
ntpSyncCache.lastReq = time.Now()
|
||||
ntpSyncCache.realTime = t
|
||||
if err == nil {
|
||||
ntpSyncCache.value = ok
|
||||
ntpSyncCache.lastReq = time.Now()
|
||||
ntpSyncCache.realTime = t
|
||||
}
|
||||
}()
|
||||
t, err = ntp.Time("ntp.aliyun.com")
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user