mirror of
https://github.com/prometheus/prometheus.git
synced 2025-08-10 16:17:09 +02: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) {
|
func parseTimestampOrNow(t string) (clientmodel.Timestamp, error) {
|
||||||
if t == "" {
|
if t == "" {
|
||||||
return clientmodel.Now(), nil
|
return clientmodel.Now(), nil
|
||||||
} else {
|
}
|
||||||
|
|
||||||
tFloat, err := strconv.ParseFloat(t, 64)
|
tFloat, err := strconv.ParseFloat(t, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
return clientmodel.TimestampFromUnixNano(int64(tFloat * float64(time.Second/time.Nanosecond))), nil
|
return clientmodel.TimestampFromUnixNano(int64(tFloat * float64(time.Second/time.Nanosecond))), nil
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseDuration(d string) (time.Duration, error) {
|
func parseDuration(d string) (time.Duration, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user