mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-23 16:18:44 +05:00
Discarding FS microseconds information, reverting to seconds since MySQL errors in older versions and default FS csv file uses seconds
This commit is contained in:
@@ -150,14 +150,24 @@ func (fsev FSEvent) MissingParameter() bool {
|
||||
strings.TrimSpace(fsev.GetCallDestNr("")) == ""
|
||||
}
|
||||
func (fsev FSEvent) GetSetupTime(fieldName string) (t time.Time, err error) {
|
||||
sTimeStr := utils.FirstNonEmpty(fsev[fieldName], fsev[SETUP_TIME])
|
||||
fsSTimeStr, hasKey := fsev[SETUP_TIME]
|
||||
if hasKey {
|
||||
// Discard the nanoseconds information since MySQL cannot store them in early versions and csv uses default seconds so cgrid will not corelate
|
||||
fsSTimeStr = fsSTimeStr[:len(fsSTimeStr)-6]
|
||||
}
|
||||
sTimeStr := utils.FirstNonEmpty(fsev[fieldName], fsSTimeStr)
|
||||
if strings.HasPrefix(fieldName, utils.STATIC_VALUE_PREFIX) { // Static value
|
||||
sTimeStr = fieldName[len(utils.STATIC_VALUE_PREFIX):]
|
||||
}
|
||||
return utils.ParseTimeDetectLayout(sTimeStr)
|
||||
}
|
||||
func (fsev FSEvent) GetAnswerTime(fieldName string) (t time.Time, err error) {
|
||||
aTimeStr := utils.FirstNonEmpty(fsev[fieldName], fsev[ANSWER_TIME])
|
||||
fsATimeStr, hasKey := fsev[ANSWER_TIME]
|
||||
if hasKey {
|
||||
// Discard the nanoseconds information since MySQL cannot store them in early versions and csv uses default seconds so cgrid will not corelate
|
||||
fsATimeStr = fsATimeStr[:len(fsATimeStr)-6]
|
||||
}
|
||||
aTimeStr := utils.FirstNonEmpty(fsev[fieldName], fsATimeStr)
|
||||
if strings.HasPrefix(fieldName, utils.STATIC_VALUE_PREFIX) { // Static value
|
||||
aTimeStr = fieldName[len(utils.STATIC_VALUE_PREFIX):]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user