| | |
| | | return tmpinfos |
| | | } |
| | | |
| | | func SourceAggregations(buf [] byte) (sources map[string]interface{}, err error) { |
| | | func SourceAggregations(buf [] byte, thresholdTime float64) (sources map[string]interface{}, err error) { |
| | | s := make(map[string]interface{}) |
| | | loc, err := time.LoadLocation("Asia/Shanghai") |
| | | if err != nil { |
| | |
| | | eTime := tmpTime |
| | | if startTime != "" { |
| | | sinTime, _ := time.ParseInLocation("2006-01-02 15:04:05", startTime, loc) |
| | | if math.Abs(sinTime.Sub(mTime).Seconds()) <= 20 { |
| | | if math.Abs(sinTime.Sub(mTime).Seconds()) <= thresholdTime { |
| | | startTime = tmpTime |
| | | hitsSources[len(hitsSources)-1]["endTime"] = tmpTime |
| | | continue |