summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2022-03-25 14:57:36 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2022-03-25 14:58:27 +0100
commitf3422f6afa7acabb96fcd50bd4a09c756afb7326 (patch)
tree07295a8e345b7e1a3bfeb956bc636da27600f4e3 /src/main.c
parent3b4aa721a46135ca1f441e79066248ad3cb79466 (diff)
#915 add seconds since ogserver has been launched
Extend GET /stats to show the number of seconds since the ogserver started. { "time": { "now": 1647262765, /* Seconds since 1970 */ "boot": 2151909 /* Seconds since boot */ "start" : 1647262854,, /* Seconds since 1970 */ }, [...]
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 270e1d4..c4148a5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -34,12 +34,16 @@ struct og_server_cfg ogconfig = {
},
};
+time_t start_time;
+
int main(int argc, char *argv[])
{
char config_file[PATH_MAX + 1] = OG_SERVER_CFG_JSON;
struct ev_io ev_io_server_rest, ev_io_agent_rest;
int val;
+ start_time = time(NULL);
+
og_loop = ev_default_loop(0);
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)