From 5473fcdaadb7bc86bf8bf387c83ed24a4b22256e Mon Sep 17 00:00:00 2001 From: Jeremy Cunningham Date: Tue, 1 Sep 2020 10:04:01 -0500 Subject: [PATCH] add mills to status upload to reduce NS client workload --- bin/ns-status.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/ns-status.js b/bin/ns-status.js index 6e67ace28..4d0543fe1 100755 --- a/bin/ns-status.js +++ b/bin/ns-status.js @@ -3,6 +3,7 @@ var os = require("os"); var fs = require('fs'); +var moment = require("moment"); var requireUtils = require('../lib/require-utils'); var requireWithTimestamp = requireUtils.requireWithTimestamp; @@ -129,6 +130,7 @@ var ns_status = function ns_status(argv_params) { if (iobArray && iobArray.length) { iob = iobArray[0]; iob.timestamp = iob.time; + iob.mills = moment(iob.time).valueOf(); delete iob.time; } @@ -141,6 +143,14 @@ var ns_status = function ns_status(argv_params) { } } + if (enacted && enacted.timestamp) { + enacted.mills = moment(enacted.timestamp).valueOf(); + } + + if (suggested && suggested.timestamp) { + suggested.mills = moment(suggested.timestamp).valueOf(); + } + var status = { device: 'openaps://' + os.hostname(), openaps: {