]> git.tuebingen.mpg.de Git - paraslash.git/commit
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)
commit5b1a844f375cc5e0303d9118ae0fc4a311c616d3
tree8ba084bc45110d1d701efb8703644ec2dae4cc28
parentb2576e98c343652649abc094ea4dc1a810371ee7
Overhaul the daemon uptime functions.

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().
audiod.c
audiod_command.c
command.c
daemon.c
daemon.h
server.c