mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08: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 a new issue