php.js
Version:
Use phpjs functions as required.
15 lines (12 loc) • 492 B
JavaScript
module.exports=function(){ return microtime.apply(exports,arguments) };
function microtime(get_as_float) {
// discuss at: http://phpjs.org/functions/microtime/
// original by: Paulo Freitas
// example 1: timeStamp = microtime(true);
// example 1: timeStamp > 1000000000 && timeStamp < 2000000000
// returns 1: true
var now = new Date()
.getTime() / 1000;
var s = parseInt(now, 10);
return (get_as_float) ? now : (Math.round((now - s) * 1000) / 1000) + ' ' + s;
}