This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
osmith gerrit-no-reply at lists.osmocom.orgosmith has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/24958 ) Change subject: vty: show uptime: use timespecsub ...................................................................... vty: show uptime: use timespecsub Related: OS#4609 Change-Id: If94795b3cd74040c49bdcbed8c410bf6e950afff --- M src/vty/command.c 1 file changed, 8 insertions(+), 6 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/src/vty/command.c b/src/vty/command.c index 3112fee..bb6a665 100644 --- a/src/vty/command.c +++ b/src/vty/command.c @@ -3067,13 +3067,15 @@ show_uptime_cmd, "show uptime", SHOW_STR "Displays how long the program has been running\n") { struct timespec now; - osmo_clock_gettime(CLOCK_MONOTONIC, &now); + struct timespec uptime; - time_t uptime = now.tv_sec - starttime.tv_sec; - int d = uptime / (3600 * 24); - int h = uptime / 3600 % 24; - int m = uptime / 60 % 60; - int s = uptime % 60; + osmo_clock_gettime(CLOCK_MONOTONIC, &now); + timespecsub(&now, &starttime, &uptime); + + int d = uptime.tv_sec / (3600 * 24); + int h = uptime.tv_sec / 3600 % 24; + int m = uptime.tv_sec / 60 % 60; + int s = uptime.tv_sec % 60; vty_out(vty, "%s has been running for %dd %dh %dm %ds%s", host.app_info->name, d, h, m, s, VTY_NEWLINE); -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/24958 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: If94795b3cd74040c49bdcbed8c410bf6e950afff Gerrit-Change-Number: 24958 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: osmith <osmith at sysmocom.de> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210719/e508e3e1/attachment.htm>