aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Bruno <lucab@redhat.com>2018-09-20 11:51:34 +0200
committerBen Kochie <superq@gmail.com>2018-09-20 11:51:34 +0200
commit4672ea1671b7adec0bfdd99339484bdeaa51f38b (patch)
treee21660cb2920a5d88f7d673fef274ec19fe72e98
parent6aa5cfba6c42ea6a9bd83787b2e595984d91f8d6 (diff)
downloadprometheus_node_collector-4672ea1671b7adec0bfdd99339484bdeaa51f38b.tar.bz2
prometheus_node_collector-4672ea1671b7adec0bfdd99339484bdeaa51f38b.tar.xz
prometheus_node_collector-4672ea1671b7adec0bfdd99339484bdeaa51f38b.zip
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 <luca.bruno@coreos.com>
-rw-r--r--collector/timex.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/collector/timex.go b/collector/timex.go
index 6309dff..ac667df 100644
--- a/collector/timex.go
+++ b/collector/timex.go
@@ -16,9 +16,6 @@
16 16
17package collector 17package collector
18 18
19// #include <sys/timex.h>
20import "C"
21
22import ( 19import (
23 "fmt" 20 "fmt"
24 "syscall" 21 "syscall"
@@ -27,10 +24,13 @@ import (
27) 24)
28 25
29const ( 26const (
30 // The system clock is not synchronized to a reliable server. 27 // The system clock is not synchronized to a reliable
31 timeError = C.TIME_ERROR 28 // server (TIME_ERROR).
32 // The timex.Status time resolution bit, 0 = microsecond, 1 = nanoseconds. 29 timeError = 5
33 staNano = C.STA_NANO 30 // The timex.Status time resolution bit (STA_NANO),
31 // 0 = microsecond, 1 = nanoseconds.
32 staNano = 0x2000
33
34 // 1 second in 34 // 1 second in
35 nanoSeconds = 1000000000 35 nanoSeconds = 1000000000
36 microSeconds = 1000000 36 microSeconds = 1000000