提交 0921e1f1 编写于 作者: S Shirou WAKAYAMA

[linux] Process.CreateTime was returned msec, not sec.

上级 3bd9ace2
......@@ -560,8 +560,7 @@ func (p *Process) fillFromStat() (string, int32, *cpu.CPUTimesStat, int64, int32
if err != nil {
return "", 0, nil, 0, 0, err
}
ctime := ((t / uint64(ClockTicks)) + uint64(bootTime)) * 1000
ctime := (t / uint64(ClockTicks)) + uint64(bootTime)
createTime := int64(ctime)
// p.Nice = mustParseInt32(fields[18])
......
......@@ -239,3 +239,15 @@ func Test_Process_CpuPercentLoop(t *testing.T) {
}
}
}
func Test_Process_CreateTime(t *testing.T) {
p := testGetProcess()
c, err := p.CreateTime()
if err != nil {
t.Errorf("error %v", err)
}
if c < 1420000000 {
t.Errorf("process created time is wrong.")
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册