cpu: fix command output trim problem.
This commit is contained in:
parent
8c17a750c6
commit
4bc631921f
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue