mirror of https://github.com/k3s-io/k3s
Merge pull request #64127 from WanLinghao/use_go_library
Automatic merge from submit-queue (batch tested with PRs 64127, 63895, 64066, 64215, 64202). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. convert Duration into seconds by go library function **What this PR does / why we need it**: Here we try convert time.Duration into int64 seconds. I think it's better to use golang library function, https://golang.org/pkg/time/#Duration.Round **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```pull/8/head
commit
5c226acc29
|
@ -20,7 +20,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
|
@ -184,7 +183,7 @@ func (o *LogsOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []str
|
|||
}
|
||||
if sinceSeconds := cmdutil.GetFlagDuration(cmd, "since"); sinceSeconds != 0 {
|
||||
// round up to the nearest second
|
||||
sec := int64(math.Ceil(float64(sinceSeconds) / float64(time.Second)))
|
||||
sec := int64(sinceSeconds.Round(time.Second).Seconds())
|
||||
logOptions.SinceSeconds = &sec
|
||||
}
|
||||
o.GetPodTimeout, err = cmdutil.GetPodRunningTimeoutFlag(cmd)
|
||||
|
|
Loading…
Reference in New Issue