mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-22 15:48:44 +05:00
LoadIDs use time.UnixNanoseconds instead of GenUUID
This commit is contained in:
committed by
Dan Christian Bogos
parent
01857c4d8a
commit
93cb87bece
@@ -186,6 +186,7 @@ func ParseTimeDetectLayout(tmStr string, timezone string) (time.Time, error) {
|
||||
astTimestamp := regexp.MustCompile(`^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d*[+,-]\d+$`)
|
||||
unixTimestampRule := regexp.MustCompile(`^\d{10}$`)
|
||||
unixTimestampMilisecondsRule := regexp.MustCompile(`^\d{13}$`)
|
||||
unixTimestampNanosecondsRule := regexp.MustCompile(`^\d{19}$`)
|
||||
oneLineTimestampRule := regexp.MustCompile(`^\d{14}$`)
|
||||
oneSpaceTimestampRule := regexp.MustCompile(`^\d{2}\.\d{2}.\d{4}\s{1}\d{2}:\d{2}:\d{2}$`)
|
||||
eamonTimestampRule := regexp.MustCompile(`^\d{2}/\d{2}/\d{4}\s{1}\d{2}:\d{2}:\d{2}$`)
|
||||
@@ -237,6 +238,12 @@ func ParseTimeDetectLayout(tmStr string, timezone string) (time.Time, error) {
|
||||
} else {
|
||||
return time.Unix(0, tmstmp*int64(time.Millisecond)).In(loc), nil
|
||||
}
|
||||
case unixTimestampNanosecondsRule.MatchString(tmStr):
|
||||
if tmstmp, err := strconv.ParseInt(tmStr, 10, 64); err != nil {
|
||||
return nilTime, err
|
||||
} else {
|
||||
return time.Unix(0, tmstmp).In(loc), nil
|
||||
}
|
||||
case tmStr == "0" || len(tmStr) == 0: // Time probably missing from request
|
||||
return nilTime, nil
|
||||
case oneLineTimestampRule.MatchString(tmStr):
|
||||
|
||||
Reference in New Issue
Block a user