mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
judge: fix sysinfo format
This commit is contained in:
1 parent
a0b0e59389
commit
dcf949dc7a
2 files changed
+3
-3
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@hydrooj/hydrojudge",
|
||||
"bin": "bin/hydrojudge.js",
|
||||
"version": "2.4.8",
|
||||
"version": "2.4.9",
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
|
||||
@@ -11,10 +11,10 @@ function size(s: number, base = 1) {
|
||||
const unit = 1024;
|
||||
const unitNames = ['Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
|
||||
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;
|
||||
}
|
||||
return '{0} {1}'.format(Math.round(s * unit), unitNames[unitNames.length - 1]);
|
||||
return `${Math.round(s * unit)} ${unitNames[unitNames.length - 1]}`;
|
||||
}
|
||||
|
||||
const cache: any = {};
|
||||
|
||||
Reference in new issue
Block a user