added hi-res timestamp to Date.js

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-11-14 04:29:04 +03:00
parent e82fcb5164
commit fd3aba0055
2 changed files with 10 additions and 1 deletions

View File

@ -15,6 +15,15 @@ var object = require('ig-object')
var DateMixin =
module.DateMixin =
object.Mixin('DateMixin', 'soft', {
hires: function(){
return typeof(process) != 'undefined' ?
performance.timeOrigin + performance.now()
: performance.timing.navigationStart + performance.now() },
hiresTimeStamp: function(){
var t = this.hires()
var date = new this(t)
return date.getTimeStamp(true) + (''+(t-date.getTime())).slice(1) },
timeStamp: function(...args){
return (new this()).getTimeStamp(...args) },
fromTimeStamp: function(ts){

View File

@ -1,6 +1,6 @@
{
"name": "ig-types",
"version": "6.20.4",
"version": "6.21.0",
"description": "Generic JavaScript types and type extensions...",
"main": "main.js",
"scripts": {