From: Florian Forster Date: Wed, 23 Dec 2009 16:38:34 +0000 (+0100) Subject: src/{ros.c,system_resource.c}: Add support for the uptime field. X-Git-Tag: librouteros-1.1.0~6 X-Git-Url: https://git.octo.it/?p=routeros-api.git;a=commitdiff_plain;h=6bc68040880f09522ea982ff7ab722921ba4cbb0 src/{ros.c,system_resource.c}: Add support for the uptime field. --- diff --git a/src/ros.c b/src/ros.c index 1849989..6d38b27 100644 --- a/src/ros.c +++ b/src/ros.c @@ -168,6 +168,7 @@ static int system_resource_handler (__attribute__((unused)) ros_connection_t *c, used_hdd_space = r->total_hdd_space - r->free_hdd_space; printf ("====== System resources ======\n" + "Uptime: %10.2f days\n" "RouterOS version: %11s\n" "Architecture name: %11s\n" "Board name: %15s\n" @@ -184,7 +185,7 @@ static int system_resource_handler (__attribute__((unused)) ros_connection_t *c, "Sectors written: %13"PRIu64" (%"PRIu64")\n" "Bad blocks: %15"PRIu64"\n" "==============================\n", - r->version, + ((double) r->uptime) / 86400.0, r->version, r->architecture_name, r->board_name, r->cpu_model, r->cpu_count, r->cpu_load, r->cpu_frequency, r->free_memory, diff --git a/src/system_resource.c b/src/system_resource.c index 2e1ef85..da3d102 100644 --- a/src/system_resource.c +++ b/src/system_resource.c @@ -62,7 +62,7 @@ static int rt_reply_to_system_resource (const ros_reply_t *r, /* {{{ */ if (strcmp ("re", ros_reply_status (r)) != 0) return (rt_reply_to_system_resource (ros_reply_next (r), ret)); - /* TODO: Uptime */ + ret->uptime = sstrtodate (ros_reply_param_val_by_key (r, "uptime")); ret->version = ros_reply_param_val_by_key (r, "version"); ret->architecture_name = ros_reply_param_val_by_key (r, "architecture-name");