mirror of
https://github.com/containers/podman.git
synced 2025-11-01 10:45:52 +08:00
build(deps): bump github.com/containers/psgo from 1.3.2 to 1.4.0
Bumps [github.com/containers/psgo](https://github.com/containers/psgo) from 1.3.2 to 1.4.0. - [Release notes](https://github.com/containers/psgo/releases) - [Commits](https://github.com/containers/psgo/compare/v1.3.2...v1.4.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
committed by
Valentin Rothberg
parent
282787f1ff
commit
5941894757
25
vendor/github.com/containers/psgo/internal/process/process.go
generated
vendored
25
vendor/github.com/containers/psgo/internal/process/process.go
generated
vendored
@ -188,23 +188,30 @@ func (p *Process) SetHostData() error {
|
||||
|
||||
// ElapsedTime returns the time.Duration since process p was created.
|
||||
func (p *Process) ElapsedTime() (time.Duration, error) {
|
||||
sinceBoot, err := strconv.ParseInt(p.Stat.Starttime, 10, 64)
|
||||
startTime, err := p.StartTime()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return (time.Now()).Sub(startTime), nil
|
||||
}
|
||||
|
||||
// StarTime returns the time.Time when process p was started.
|
||||
func (p *Process) StartTime() (time.Time, error) {
|
||||
sinceBoot, err := strconv.ParseInt(p.Stat.Starttime, 10, 64)
|
||||
if err != nil {
|
||||
return time.Time{}, err
|
||||
}
|
||||
clockTicks, err := host.ClockTicks()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
return time.Time{}, err
|
||||
}
|
||||
bootTime, err := host.BootTime()
|
||||
if err != nil {
|
||||
return time.Time{}, err
|
||||
}
|
||||
|
||||
sinceBoot = sinceBoot / clockTicks
|
||||
|
||||
bootTime, err := host.BootTime()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
created := time.Unix(sinceBoot+bootTime, 0)
|
||||
return (time.Now()).Sub(created), nil
|
||||
return time.Unix(sinceBoot+bootTime, 0), nil
|
||||
}
|
||||
|
||||
// CPUTime returns the cumlative CPU time of process p as a time.Duration.
|
||||
|
||||
Reference in New Issue
Block a user