1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Correct relative date handling of t=1s

We were incorrectly displaying “1 seconds ago”
This commit is contained in:
Jermolene 2014-03-31 12:41:54 +01:00
parent 5a085f7927
commit 914a536d82
2 changed files with 22 additions and 3 deletions

View File

@ -12,16 +12,18 @@ RelativeDate/Future/Days: <<period>> days from now
RelativeDate/Future/Hours: <<period>> hours from now
RelativeDate/Future/Minutes: <<period>> minutes from now
RelativeDate/Future/Months: <<period>> months from now
RelativeDate/Future/Second: 1 second from now
RelativeDate/Future/Seconds: <<period>> seconds from now
RelativeDate/Future/Years: <<period>> years from now
RelativeDate/Past/Days: <<period>> days ago
RelativeDate/Past/Hours: <<period>> hours ago
RelativeDate/Past/Minutes: <<period>> minutes ago
RelativeDate/Past/Months: <<period>> months ago
RelativeDate/Past/Second: 1 second ago
RelativeDate/Past/Seconds: <<period>> seconds ago
RelativeDate/Past/Years: <<period>> 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

View File

@ -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;
}
})();