timefix
This commit is contained in:
@ -469,9 +469,12 @@ class ListenController {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// -- Commit each record to DB --
|
// -- Commit each record to DB --
|
||||||
// records.forEach(async (rec) => {
|
let previousCrtD = 0
|
||||||
for (const rec of records) {
|
for (const rec of records) {
|
||||||
// console.log("rec ====> ", rec)
|
// console.log("rec ====> ", rec)
|
||||||
|
// avoid duplicate timestamp
|
||||||
|
if (previousCrtD == rec.gnss.timestamp) continue
|
||||||
|
previousCrtD = rec.gnss.timestamp
|
||||||
|
|
||||||
const now = moment().unix()
|
const now = moment().unix()
|
||||||
const logDevice = {
|
const logDevice = {
|
||||||
@ -505,8 +508,9 @@ class ListenController {
|
|||||||
drv_milleage: rec.io["Trip Odometer"] || 0,
|
drv_milleage: rec.io["Trip Odometer"] || 0,
|
||||||
crt: now,
|
crt: now,
|
||||||
crt_format: moment.unix(now).format("YYYY-MM-DD HH:mm:ss"),
|
crt_format: moment.unix(now).format("YYYY-MM-DD HH:mm:ss"),
|
||||||
crt_d: rec.gnss.timestamp / 1000,
|
// minus 7 hours -- ngikutin data gt06 biar sinkron
|
||||||
crt_d_format: moment.unix(rec.gnss.timestamp / 1000).format("YYYY-MM-DD HH:mm:ss"),
|
crt_d: rec.gnss.timestamp / 1000 - 25200,
|
||||||
|
crt_d_format: moment.unix(rec.gnss.timestamp / 1000 - 25200).format("YYYY-MM-DD HH:mm:ss"),
|
||||||
crt_s: now,
|
crt_s: now,
|
||||||
crt_s_format: moment.unix(now).format("YYYY-MM-DD HH:mm:ss"),
|
crt_s_format: moment.unix(now).format("YYYY-MM-DD HH:mm:ss"),
|
||||||
fuel_curr: rec.io["Fuel Level"] || 0,
|
fuel_curr: rec.io["Fuel Level"] || 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user