summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/prometheus/common/model/time.go
diff options
context:
space:
mode:
authorAntoine GIRARD <sapk@users.noreply.github.com>2019-08-28 08:55:22 +0200
committerGitHub <noreply@github.com>2019-08-28 08:55:22 +0200
commit256b1781760beb08ae4bdde3c2750ea21c9c8fc6 (patch)
tree3ceb7ed14cdab8a1b8fbf169bebce1478af79522 /vendor/github.com/prometheus/common/model/time.go
parente0f95d1545eaf9cc4ebae9df1ff03d3e66d5b251 (diff)
downloadgitea-256b1781760beb08ae4bdde3c2750ea21c9c8fc6.tar.gz
gitea-256b1781760beb08ae4bdde3c2750ea21c9c8fc6.zip
Update swagger to 0.20.1 (#8010)
* update swagger to 0.20.1 * fiw swagger version for validate
Diffstat (limited to 'vendor/github.com/prometheus/common/model/time.go')
-rw-r--r--vendor/github.com/prometheus/common/model/time.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/vendor/github.com/prometheus/common/model/time.go b/vendor/github.com/prometheus/common/model/time.go
index 46259b1f10..7b0064fdb2 100644
--- a/vendor/github.com/prometheus/common/model/time.go
+++ b/vendor/github.com/prometheus/common/model/time.go
@@ -150,7 +150,13 @@ func (t *Time) UnmarshalJSON(b []byte) error {
return err
}
- *t = Time(v + va)
+ // If the value was something like -0.1 the negative is lost in the
+ // parsing because of the leading zero, this ensures that we capture it.
+ if len(p[0]) > 0 && p[0][0] == '-' && v+va > 0 {
+ *t = Time(v+va) * -1
+ } else {
+ *t = Time(v + va)
+ }
default:
return fmt.Errorf("invalid time %q", string(b))