Detect-It-Easy/db/duration
DosX 33711a0407 Add standard DiE-JS framework header to db files
Added a standard header comment to all db framework and detection rule files, indicating they are part of the Detect It Easy (DiE-JS) framework and warning against unauthorized changes. This improves consistency and clarifies file purpose for maintainers.
2025-08-27 23:21:24 +03:00

17 lines
No EOL
567 B
Text
Executable file

// Detect It Easy: DiE-JS framework file
// Don't change anything unless you're sure about what you're doing
// Convert a time in seconds to a string:
// less than 10 seconds: N.NNs
// less than a minute: NN.Ns
// otherwise: NmNNs
// Author: Jason Hood <jadoxa@yahoo.com.au>
function duration(nSeconds) {
if (nSeconds < 60) {
return nSeconds.toFixed(nSeconds < 10 ? 2 : 1) + "s";
}
nSeconds = Math.round(nSeconds);
return Math.floor(nSeconds / 60) + "m" +
("0" + Math.floor(nSeconds % 60)).slice(-2) + "s";
}