From 4672ea1671b7adec0bfdd99339484bdeaa51f38b Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Thu, 20 Sep 2018 11:51:34 +0200 Subject: [PATCH] collector/timex: remove cgo dependency (#1079) This removes the cgo import from timex collector, as it was only used to define two constants. Those are part of the Linux kernel<->userspace interface, thus there is no need to depend on libc to source them: https://github.com/torvalds/linux/blob/v4.18/include/uapi/linux/timex.h Signed-off-by: Luca Bruno --- collector/timex.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/collector/timex.go b/collector/timex.go index 6309dff6..ac667df3 100644 --- a/collector/timex.go +++ b/collector/timex.go @@ -16,9 +16,6 @@ package collector -// #include -import "C" - import ( "fmt" "syscall" @@ -27,10 +24,13 @@ import ( ) const ( - // The system clock is not synchronized to a reliable server. - timeError = C.TIME_ERROR - // The timex.Status time resolution bit, 0 = microsecond, 1 = nanoseconds. - staNano = C.STA_NANO + // The system clock is not synchronized to a reliable + // server (TIME_ERROR). + timeError = 5 + // The timex.Status time resolution bit (STA_NANO), + // 0 = microsecond, 1 = nanoseconds. + staNano = 0x2000 + // 1 second in nanoSeconds = 1000000000 microSeconds = 1000000