diff --git a/cpu/cpu_darwin.go b/cpu/cpu_darwin.go index ff27a74..4f7dbde 100644 --- a/cpu/cpu_darwin.go +++ b/cpu/cpu_darwin.go @@ -27,7 +27,7 @@ func init() { out, err := exec.Command("/usr/bin/getconf", "CLK_TCK").Output() // ignore errors if err == nil { - i, err := strconv.ParseFloat(string(out), 64) + i, err := strconv.ParseFloat(strings.TrimSpace(string(out)), 64) if err == nil { ClocksPerSec = float64(i) } diff --git a/cpu/cpu_freebsd.go b/cpu/cpu_freebsd.go index c1e542e..2c22a39 100644 --- a/cpu/cpu_freebsd.go +++ b/cpu/cpu_freebsd.go @@ -28,7 +28,7 @@ func init() { out, err := exec.Command("/usr/bin/getconf", "CLK_TCK").Output() // ignore errors if err == nil { - i, err := strconv.ParseFloat(string(out), 64) + i, err := strconv.ParseFloat(strings.TrimSpace(string(out)), 64) if err == nil { ClocksPerSec = float64(i) } diff --git a/cpu/cpu_linux.go b/cpu/cpu_linux.go index 5499389..74054dd 100644 --- a/cpu/cpu_linux.go +++ b/cpu/cpu_linux.go @@ -17,7 +17,7 @@ func init() { out, err := exec.Command("/usr/bin/getconf", "CLK_TCK").Output() // ignore errors if err == nil { - i, err := strconv.ParseFloat(string(out), 64) + i, err := strconv.ParseFloat(strings.TrimSpace(string(out)), 64) if err == nil { cpu_tick = float64(i) }