feat(watchdog): 检测主机丢失安装时的地址与时钟未经 NTP 同步
This commit is contained in:
5 files changed
+173
-1
No files matched your search
@@ -0,0 +1,15 @@
|
||||
//go:build linux
|
||||
|
||||
package watchdog
|
||||
|
||||
import "syscall"
|
||||
|
||||
// ClockStatus reads the kernel's clock status word. Modes stays zero, so the
|
||||
// call only reads and needs no privilege.
|
||||
func ClockStatus() (int32, bool) {
|
||||
var t syscall.Timex
|
||||
if _, err := syscall.Adjtimex(&t); err != nil {
|
||||
return 0, false
|
||||
}
|
||||
return t.Status, true
|
||||
}
|
||||
Reference in new issue
Block a user