mirror of
https://github.com/LiBwrt-op/openwrt-6.x.git
synced 2025-12-29 23:35:40 +00:00
This provides an easy to use modular CLI that can be used to interact with OpenWrt services. It has full support for context sensitive tab completion and help. Extra modules can be provided by packages and can extend the existing node structure in any place. Signed-off-by: Felix Fietkau <nbd@nbd.name>
27 lines
380 B
Ucode
27 lines
380 B
Ucode
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
// Copyright (C) 2025 Felix Fietkau <nbd@nbd.name>
|
|
'use strict';
|
|
|
|
export function time_format(val)
|
|
{
|
|
let ret = `${val % 60}s`;
|
|
|
|
val /= 60;
|
|
if (!val)
|
|
return ret;
|
|
|
|
ret = `${val % 60}m ${ret}`;
|
|
|
|
val /= 60;
|
|
if (!val)
|
|
return ret;
|
|
|
|
ret = `${val % 24 }h ${ret}`;
|
|
|
|
val /= 24;
|
|
if (!val)
|
|
return ret;
|
|
|
|
return `${val}d ${ret}`;
|
|
};
|