|
|
@ -9,6 +9,7 @@ import ( |
|
|
|
"encoding/binary" |
|
|
|
"encoding/binary" |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"time" |
|
|
|
"time" |
|
|
|
|
|
|
|
"math" |
|
|
|
//"encoding/hex"
|
|
|
|
//"encoding/hex"
|
|
|
|
"strconv" |
|
|
|
"strconv" |
|
|
|
"sort" |
|
|
|
"sort" |
|
|
@ -320,10 +321,18 @@ func parseData(data []byte, imei uint64, tagOption *opt.Options) (rec DeviceReco |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
deviceRecord.TagDevices = tags_ |
|
|
|
deviceRecord.TagDevices = tags_ |
|
|
|
deviceRecords = append(deviceRecords, deviceRecord) |
|
|
|
|
|
|
|
|
|
|
|
tstampToNow := time.Since(deviceRecord.Tstamp) |
|
|
|
|
|
|
|
hCurr := math.Round(tstampToNow.Hours()*100)/100 |
|
|
|
|
|
|
|
if hCurr >= -24 { |
|
|
|
|
|
|
|
deviceRecords = append(deviceRecords, deviceRecord) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rec.NumRec = uint16(len(deviceRecords)) |
|
|
|
|
|
|
|
|
|
|
|
//sort ascending by date
|
|
|
|
//sort ascending by date
|
|
|
|
sort.Sort(ByTstamp(deviceRecords)) |
|
|
|
sort.Sort(ByTstamp(deviceRecords)) |
|
|
|
|
|
|
|
|
|
|
|