1
0
mirror of https://git.hibas.dev/OpenServer/NodeLogging.git synced 2025-11-03 22:40:45 +00:00

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

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;