cpu: fix command output trim problem.

This commit is contained in:
WAKAYAMA shirou 2015-07-17 21:52:43 +09:00
parent 8c17a750c6
commit 4bc631921f
3 changed files with 3 additions and 3 deletions

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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)
}