From: Andre Noll Date: Wed, 10 Aug 2011 22:01:11 +0000 (+0200) Subject: Overhaul the daemon uptime functions. X-Git-Tag: v0.4.9~20^2 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=5b1a844f375cc5e0303d9118ae0fc4a311c616d3;hp=5b1a844f375cc5e0303d9118ae0fc4a311c616d3;ds=sidebyside 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(). ---