diff --git a/package/gluon-respondd/src/respondd.c b/package/gluon-respondd/src/respondd.c index a31693e6..567d47c9 100644 --- a/package/gluon-respondd/src/respondd.c +++ b/package/gluon-respondd/src/respondd.c @@ -34,6 +34,7 @@ #include #include #include +#include #include @@ -211,11 +212,24 @@ static struct json_object * get_rootfs_usage(void) { return jso; } +static struct json_object * get_time(void) { + struct timespec now; + + if (clock_gettime(CLOCK_REALTIME, &now) != 0) + return NULL; + + return json_object_new_int64(now.tv_sec); +} + static struct json_object * respondd_provider_statistics(void) { struct json_object *ret = json_object_new_object(); json_object_object_add(ret, "node_id", gluonutil_wrap_and_free_string(gluonutil_get_node_id())); + json_object *time = get_time(); + if (time != NULL) + json_object_object_add(ret, "time", time); + json_object_object_add(ret, "rootfs_usage", get_rootfs_usage()); json_object_object_add(ret, "memory", get_memory());