From 914a536d8213c61f01deb210632016461157383b Mon Sep 17 00:00:00 2001 From: Jermolene Date: Mon, 31 Mar 2014 12:41:54 +0100 Subject: [PATCH] Correct relative date handling of t=1s MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We were incorrectly displaying “1 seconds ago” --- core/language/en-GB/Misc.multids | 6 ++++-- core/modules/utils/utils.js | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/core/language/en-GB/Misc.multids b/core/language/en-GB/Misc.multids index c27e81cd3..0d41e89a3 100644 --- a/core/language/en-GB/Misc.multids +++ b/core/language/en-GB/Misc.multids @@ -12,16 +12,18 @@ RelativeDate/Future/Days: <> days from now RelativeDate/Future/Hours: <> hours from now RelativeDate/Future/Minutes: <> minutes from now RelativeDate/Future/Months: <> months from now +RelativeDate/Future/Second: 1 second from now RelativeDate/Future/Seconds: <> seconds from now RelativeDate/Future/Years: <> years from now RelativeDate/Past/Days: <> days ago RelativeDate/Past/Hours: <> hours ago RelativeDate/Past/Minutes: <> minutes ago RelativeDate/Past/Months: <> months ago +RelativeDate/Past/Second: 1 second ago RelativeDate/Past/Seconds: <> seconds ago RelativeDate/Past/Years: <> years ago SystemTiddler/Tooltip: This is a system tiddler -TagManager/Tag/Heading: Tag -TagManager/Count/Heading: Count TagManager/Colour/Heading: Colour +TagManager/Count/Heading: Count TagManager/Icon/Heading: Icon +TagManager/Tag/Heading: Tag diff --git a/core/modules/utils/utils.js b/core/modules/utils/utils.js index b9fe4f816..8e2e79167 100644 --- a/core/modules/utils/utils.js +++ b/core/modules/utils/utils.js @@ -239,7 +239,7 @@ exports.getRelativeDate = function(delta) { return { delta: delta, description: $tw.language.getString( - "RelativeDate/" + (futurep ? "Future" : "Past") + "/Seconds", + "RelativeDate/" + (futurep ? "Future" : "Past") + "/Second", {variables: {period: "1"} } @@ -451,4 +451,21 @@ exports.makeTiddlerDictionary = function(data) { return output.join("\n"); }; +/* +High resolution microsecond timer for profiling +*/ +exports.timer = function(base) { + var m; + if($tw.node) { + var r = process.hrtime(); + m = r[0] * 1e3 + (r[1] / 1e6); + } else { + m = performance.now(); + } + if(typeof base !== "undefined") { + m = m - base; + } + return m; +} + })();