Tools for EventScripter

System function: time()

Description

time([bool as_milliseconds = false]) : number

Gets the current timestamp.

Example

// Trigger Required: "Interval"
// Options recommended: 10000ms, synchronous

require(JD_HOME + "/eventscripter/system/time.js");
alert("current timestamp: " + time());

Sourcecode

JD_HOME/eventscripter/system/time.js
/*jslint browser */
/*global  */
function time(asMiliseconds) {
    "use strict";

    return (
        asMiliseconds
        ? Date.now()
        : Math.floor(Date.now() / 1000)
    );
}