From: Bill Stoddard Date: Sun, 4 Feb 2001 03:12:49 +0000 (+0000) Subject: More mod_status work... Get Current Time, Restart Time and Server uptime X-Git-Tag: APACHE_2_0_BETA_CANDIDATE_1~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fb22c5beb23c9a88f23167072d3832bd84f2edad;p=apache More mod_status work... Get Current Time, Restart Time and Server uptime displaying properly. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87972 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/generators/mod_status.c b/modules/generators/mod_status.c index 989076f124..bb68550597 100644 --- a/modules/generators/mod_status.c +++ b/modules/generators/mod_status.c @@ -177,9 +177,12 @@ static void format_kbyte_out(request_rec *r, unsigned long kbytes) ap_rprintf(r, "%.1f GB", (float) kbytes / MBYTE); } -static void show_time(request_rec *r, time_t tsecs) +static void show_time(request_rec *r, apr_time_t tsecs) { long days, hrs, mins, secs; + + /* convert apr_time_t (in micro seconds) to seconds */ + tsecs = tsecs/1000000; secs = tsecs % 60; tsecs /= 60; @@ -225,7 +228,7 @@ static char status_flags[SERVER_NUM_STATUS]; static int status_handler(request_rec *r) { const char *loc; - time_t nowtime = time(NULL); + apr_time_t nowtime = apr_now(); time_t up_time; int j, i, res; int ready = 0; diff --git a/server/mpm/beos/beos.c b/server/mpm/beos/beos.c index ba6e9e1d0d..761e5ab14a 100644 --- a/server/mpm/beos/beos.c +++ b/server/mpm/beos/beos.c @@ -97,7 +97,7 @@ static int ap_threads_to_start=0; static int min_spare_threads=0; static int max_spare_threads=0; static int ap_thread_limit=0; -static time_t ap_restart_time=0; +static apr_time_t ap_restart_time=0; AP_DECLARE_DATA int ap_extended_status = 0; static int num_listening_sockets = 0; /* set by open_listeners in ap_mpm_run */ static apr_socket_t ** listening_sockets; @@ -797,7 +797,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) } if (!is_graceful) { - ap_restart_time = time(NULL); + ap_restart_time = apr_now(); } /* just before we go, tidy up the locks we've created to prevent a diff --git a/server/mpm/mpmt_beos/mpmt_beos.c b/server/mpm/mpmt_beos/mpmt_beos.c index 9d41c2ac8e..616cdb7d56 100644 --- a/server/mpm/mpmt_beos/mpmt_beos.c +++ b/server/mpm/mpmt_beos/mpmt_beos.c @@ -91,7 +91,7 @@ static int ap_daemons_to_start=0; static int min_spare_threads=0; static int max_spare_threads=0; static int ap_daemons_limit=0; -static time_t ap_restart_time=0; +static apr_time_t ap_restart_time=0; AP_DECLARE_DATA int ap_extended_status = 0; static int workers_may_exit = 0; static int requests_this_child; @@ -809,7 +809,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) "SIGHUP received. Attempting to restart"); } if (!is_graceful) { - ap_restart_time = time(NULL); + ap_restart_time = apr_now(); } delete_port(port_of_death); return 0; diff --git a/server/mpm/mpmt_pthread/mpmt_pthread.c b/server/mpm/mpmt_pthread/mpmt_pthread.c index 6d5032b437..368cb1b467 100644 --- a/server/mpm/mpmt_pthread/mpmt_pthread.c +++ b/server/mpm/mpmt_pthread/mpmt_pthread.c @@ -1148,7 +1148,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) "SIGHUP received. Attempting to restart"); } if (!is_graceful) { - ap_restart_time = time(NULL); + ap_restart_time = apr_now(); } return 0; } diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index 63e4d97a9e..ef826cdd9b 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -1283,7 +1283,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) } if (!is_graceful) { - ap_restart_time = time(NULL); + ap_restart_time = apr_now(); } return 0; diff --git a/server/mpm/spmt_os2/spmt_os2.c b/server/mpm/spmt_os2/spmt_os2.c index d22f02a735..f8a2983e2f 100644 --- a/server/mpm/spmt_os2/spmt_os2.c +++ b/server/mpm/spmt_os2/spmt_os2.c @@ -90,7 +90,7 @@ static int ap_daemons_to_start=0; static int ap_daemons_min_free=0; static int ap_daemons_max_free=0; static int ap_daemons_limit=0; -static time_t ap_restart_time=0; +static apr_time_t ap_restart_time=0; static int ap_extended_status = 0; /* @@ -1358,7 +1358,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) } if (!is_graceful) { - ap_restart_time = time(NULL); + ap_restart_time = apr_now(); } return 0; diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index 8e135ebc98..9773fb2c2a 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -1240,7 +1240,7 @@ static void child_main() /* Set up the scoreboard. The scoreboard in this MPM only applies to the * child process and is not shared across processes */ - ap_restart_time = time(NULL); + ap_restart_time = apr_now(); ap_create_scoreboard(pconf, SB_NOT_SHARED); /* This is the child process or we are running in single process