]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Overhaul the daemon uptime functions.
authorAndre Noll <maan@systemlinux.org>
Wed, 10 Aug 2011 22:01:11 +0000 (00:01 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 17 Sep 2011 16:49:55 +0000 (18:49 +0200)
The public interface of daemon.c offers some helpers for maintaining
and printing the uptime of the service. This interface consists of
the "uptime" enumeration and the public functions server_uptime()
and uptime_str(). The former function takes an uptime enum which is
either 'UPTIME_GET' or 'UPTIME_SET'.

It is cleaner to avoid the enumeration and have two separate
functions for getting and setting the uptime, so this patch
replaces server_uptime() by two new functions get_server_uptime()
and set_server_start_time(), renames uptime_str() to
get_server_uptime_str() and gets rid of the uptime enum.

All three new functions take an optional struct timeval * type argument
for the common case where the caller already knows the current time, or
wishes to specify another time for whatever reason. This allows to save
one time() system call per scheduler loop in para_server since with
this patch status_refresh() can pass the global "now" pointer (which
us updated by the scheduler once per loop) to get_server_uptime().


No differences found