diff --git a/lib/main.js b/lib/main.js
index 064c8bba5ab7b3eb3addff154cdc2f037d473ea9..a57ec2712abde46231fb6793e484716b7f460eb1 100755
--- a/lib/main.js
+++ b/lib/main.js
@@ -3,12 +3,17 @@
const co = require('co');
const webserver = require(__dirname + '/webserver.js');
-//const duniter = require(__dirname + '/duniter.js');
+const timestampToDatetime = require(__dirname + '/timestampToDatetime.js');
/****************************
* Main algorithm
*/
module.exports = (duniterServer, host, port, appParente, program) => co(function *() {
+
+ // Get local timezone offset
+ var x = new Date();
+ var offset = -x.getTimezoneOffset();
+ //timestampToDatetime(1000000, true, offset);
// Define cache
var cache = {
@@ -34,7 +39,7 @@ module.exports = (duniterServer, host, port, appParente, program) => co(function
console.log("module currency-monit started");
// Specialized node's UI
- let httpServer = webserver(host, port, appParente, duniterServer, cache);
+ let httpServer = webserver(host, port, appParente, duniterServer, offset, cache);
yield httpServer.openConnection();
})
diff --git a/lib/timestampToDatetime.js b/lib/timestampToDatetime.js
index b44f46505f749d496837239fa1355785bd00cfbb..5b86854aef88cc4a7f5642aed7dab831f7068fd3 100755
--- a/lib/timestampToDatetime.js
+++ b/lib/timestampToDatetime.js
@@ -1,4 +1,14 @@
-module.exports = function timestampToDatetime(timestamp, onlyDate = false) {
+// cache offset
+var offset = 0;
+
+module.exports = function timestampToDatetime(timestamp, onlyDate = false, offset_ = 0) {
+ if (offset_ != 0) {
+ offset = offset_;
+ }
+
+ // Apply offset
+ timestamp += offset*60; // offset is in minutes
+
// Convertir le timestamp en datetime
let tmptimestampExpireCertif = new Date(timestamp*1000);//tmpQueryGetTimeWrittenCert[0].medianTime)*1000);
let tmptimestampExpireCertifDay = tmptimestampExpireCertif.getDate();