From 65c5278169ea8f59bc3bdabaad203e5f8e20d7d7 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Sun, 17 Jan 2016 23:36:14 +0500 Subject: [PATCH] reduce accuracy of time property of storage items to seconds to save some space of local storage, #339 --- js/twister_io.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/js/twister_io.js b/js/twister_io.js index e46cfb5..5b02882 100644 --- a/js/twister_io.js +++ b/js/twister_io.js @@ -328,11 +328,10 @@ function _getResourceFromStorage(locator) { } function _putResourceIntoStorage(locator, data) { - var curTime = new Date().getTime() / 1000; - var storedResource = {time: curTime, data: data}; - - var storage = $.localStorage; - storage.set(locator, storedResource); + $.localStorage.set(locator, { + time: Math.trunc(new Date().getTime() / 1000), + data: data + }); } function cleanupStorage() {