mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-25 17:18:44 +05:00
Cache with -1 for unlimited, ResourceS with short and long caching
This commit is contained in:
@@ -265,8 +265,11 @@ func CopyHour(src, dest time.Time) time.Time {
|
||||
}
|
||||
|
||||
// Parses duration, considers s as time unit if not provided, seconds as float to specify subunits
|
||||
func ParseDurationWithSecs(durStr string) (time.Duration, error) {
|
||||
if _, err := strconv.ParseFloat(durStr, 64); err == nil { // Seconds format considered
|
||||
func ParseDurationWithSecs(durStr string) (d time.Duration, err error) {
|
||||
if durStr == "" {
|
||||
return
|
||||
}
|
||||
if _, err = strconv.ParseFloat(durStr, 64); err == nil { // Seconds format considered
|
||||
durStr += "s"
|
||||
}
|
||||
return time.ParseDuration(durStr)
|
||||
|
||||
Reference in New Issue
Block a user