judge: fix sysinfo format

This commit is contained in:
undefined committed 2021-03-07 21:31:24 +08:00
1 parent a0b0e59389
commit dcf949dc7a
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "@hydrooj/hydrojudge", "name": "@hydrooj/hydrojudge",
"bin": "bin/hydrojudge.js", "bin": "bin/hydrojudge.js",
"version": "2.4.8", "version": "2.4.9",
"os": [ "os": [
"linux" "linux"
], ],
+2 -2
View File
@@ -11,10 +11,10 @@ function size(s: number, base = 1) {
const unit = 1024; const unit = 1024;
const unitNames = ['Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']; const unitNames = ['Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
for (const unitName of unitNames) { for (const unitName of unitNames) {
if (s < unit) return '{0} {1}'.format(Math.round(s * 10) / 10, unitName); if (s < unit) return `${Math.round(s * 10) / 10} ${unitName}`;
s /= unit; s /= unit;
} }
return '{0} {1}'.format(Math.round(s * unit), unitNames[unitNames.length - 1]); return `${Math.round(s * unit)} ${unitNames[unitNames.length - 1]}`;
} }
const cache: any = {}; const cache: any = {};