mirror of
https://github.com/prometheus/prometheus
synced 2024-12-26 08:33:06 +00:00
Remove unnecessary "else" branch in query API.
This commit is contained in:
parent
a68b880c27
commit
df314ead84
@ -43,13 +43,13 @@ func setAccessControlHeaders(w http.ResponseWriter) {
|
||||
func parseTimestampOrNow(t string) (clientmodel.Timestamp, error) {
|
||||
if t == "" {
|
||||
return clientmodel.Now(), nil
|
||||
} else {
|
||||
tFloat, err := strconv.ParseFloat(t, 64)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return clientmodel.TimestampFromUnixNano(int64(tFloat * float64(time.Second/time.Nanosecond))), nil
|
||||
}
|
||||
|
||||
tFloat, err := strconv.ParseFloat(t, 64)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return clientmodel.TimestampFromUnixNano(int64(tFloat * float64(time.Second/time.Nanosecond))), nil
|
||||
}
|
||||
|
||||
func parseDuration(d string) (time.Duration, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user