// retryAfter parses a Retry-After HTTP header value,
// trying to convert v into an int (seconds) or use http.ParseTime otherwise.
// It returns d if v cannot be parsed.
retryAfter parses a Retry-After HTTP header value,
trying to convert v into an int (seconds) or use http.ParseTime otherwise.
It returns d if v cannot be parsed.
// retryAfter parses a Retry - After HTTP header value // trying to convert v into an int ( seconds ) or use http . ParseTime otherwise . // It returns d if v cannot be parsed .
func retryAfter(v string, d time.Duration) time.Duration {
	if i, err := strconv.Atoi(v); err == nil {
		return time.Duration(i) * time.Second
	}
	t, err := http.ParseTime(v)
	if err != nil {
		return d
	}
	return t.Sub(timeNow())
}
func retryAfter ( v string , d time . Duration ) time . Duration { if i , err := strconv . Atoi ( v ) ; err == nil { return time . Duration ( i ) * time . Second } t , err := http . ParseTime ( v ) if err != nil { return d } return t . Sub ( timeNow ( ) ) }
retryAfter parses a Retry-After HTTP header value,
trying to convert v into an int (seconds) or use http.ParseTime otherwise.
retryAfter parses a Retry - After HTTP header value trying to convert v into an int ( seconds ) or use http . ParseTime otherwise .