From 0921e1f1536769f17ff188a253294adcbc4e2c03 Mon Sep 17 00:00:00 2001 From: Shirou WAKAYAMA Date: Fri, 19 Jun 2015 12:04:33 +0900 Subject: [PATCH] [linux] Process.CreateTime was returned msec, not sec. --- process/process_linux.go | 3 +-- process/process_test.go | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/process/process_linux.go b/process/process_linux.go index f7127ce..2da019a 100644 --- a/process/process_linux.go +++ b/process/process_linux.go @@ -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]) diff --git a/process/process_test.go b/process/process_test.go index e3b902d..b06df86 100644 --- a/process/process_test.go +++ b/process/process_test.go @@ -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.") + } +}