summaryrefslogtreecommitdiff
path: root/pkg/util/utils.go
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2021-08-05 17:45:31 +0000
committerGitHub <noreply@github.com>2021-08-05 17:45:31 +0000
commitb243185e4fbf002c381b4d6cf9be1fe25450f4b9 (patch)
treebbc7863f5af9f83df6d7d484e580da22e98d6383 /pkg/util/utils.go
parentfaf489b7b26d462b6487c085b1f0840df46660f7 (diff)
parent8cbbbe6efe5da34da1cdb2c750f4d26e3d306ed5 (diff)
downloadpodman-b243185e4fbf002c381b4d6cf9be1fe25450f4b9.tar.gz
podman-b243185e4fbf002c381b4d6cf9be1fe25450f4b9.tar.bz2
podman-b243185e4fbf002c381b4d6cf9be1fe25450f4b9.zip
Merge pull request #11135 from matejvasek/fix_ts
Fix TS parsing for fractional values
Diffstat (limited to 'pkg/util/utils.go')
-rw-r--r--pkg/util/utils.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/pkg/util/utils.go b/pkg/util/utils.go
index 60aa64ac1..774590f44 100644
--- a/pkg/util/utils.go
+++ b/pkg/util/utils.go
@@ -3,6 +3,7 @@ package util
import (
"encoding/json"
"fmt"
+ "math"
"os"
"os/user"
"path/filepath"
@@ -530,9 +531,10 @@ func ParseInputTime(inputTime string) (time.Time, error) {
}
}
- unixTimestamp, err := strconv.ParseInt(inputTime, 10, 64)
+ unixTimestamp, err := strconv.ParseFloat(inputTime, 64)
if err == nil {
- return time.Unix(unixTimestamp, 0), nil
+ iPart, fPart := math.Modf(unixTimestamp)
+ return time.Unix(int64(iPart), int64(fPart*1_000_000_000)).UTC(), nil
}
// input might be a duration