Update time functions

This commit is contained in:
Fabian Stamm
2025-10-21 13:59:29 +02:00
parent a399225c43
commit 453128fc4f
3 changed files with 433 additions and 2856 deletions

3263
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{
"name": "@hibas123/nodelogging",
"packageManager": "yarn@3.6.4",
"version": "3.1.6",
"version": "4.0.1",
"description": "",
"main": "out/index.js",
"types": "out/index.d.ts",
@ -30,13 +30,13 @@
"readme.md"
],
"devDependencies": {
"@types/node": "^20.8.6",
"concurrently": "^8.2.1",
"nodemon": "^3.0.1",
"typescript": "^5.2.2"
"@types/node": "^24.9.1",
"concurrently": "^9.2.1",
"nodemon": "^3.1.10",
"typescript": "^5.9.3"
},
"dependencies": {
"@hibas123/logging": "^3.1.2",
"@hibas123/logging": "^4.0.2",
"@hibas123/utils": "^2.2.18"
}
}

View File

@ -11,6 +11,14 @@ LoggingBase.nativeFunctions = {
return process.hrtime();
}
},
diffTime: (start, end) => {
if (process.hrtime.bigint) {
return Number((BigInt(end) - BigInt(start)) / BigInt(1000)) / 1000;
} else {
let diff = process.hrtime(start);
return diff[0] * 1000 + diff[1] / 1000000;
}
},
endTimer: (start) => {
if (process.hrtime.bigint) {
return Number((process.hrtime.bigint() - start) / BigInt(1000)) / 1000;