This function receives a pointer to a timeval structure which is
supposed to contain the daemon startup time. Passing NULL means to
set the daemon startup time to the current time.
There are only two callers of this function, in audiod.c and in
server.c. The first one passes NULL, the other one initialises the
timeval structure pointed to by the global now pointer to the current
time, and passes this pointer.
It's easier to let set_server_start_time() always act as if NULL had
been passed.
exit(EXIT_FAILURE);
}
log_welcome("para_audiod");
exit(EXIT_FAILURE);
}
log_welcome("para_audiod");
- set_server_start_time(NULL);
+ set_server_start_time();
set_initial_status();
FOR_EACH_SLOT(i)
clear_slot(i);
set_initial_status();
FOR_EACH_SLOT(i)
clear_slot(i);
/**
* Set the server startup time.
*
/**
* Set the server startup time.
*
- * \param startuptime The value to store as the server start time.
+ * This should be called once on startup. It sets the server start time to the
+ * current time. The stored time is used for retrieving the server uptime.
- * This should be called once on startup with \a startuptime either NULL or a
- * pointer to a struct timeval which contains the current time. If \a
- * startuptime is NULL, the server start time is set to the current time.
- *
- * \sa time(2), difftime(3) \ref get_server_uptime(), \ref
- * get_server_uptime_str().
+ * \sa time(2), \ref get_server_uptime(), \ref get_server_uptime_str().
-void set_server_start_time(const struct timeval *startuptime)
+void set_server_start_time(void)
- if (startuptime)
- me->startuptime = startuptime->tv_sec;
- else
- time(&me->startuptime);
+ time(&me->startuptime);
void daemon_close_log(void);
void log_welcome(const char *whoami);
void drop_privileges_or_die(const char *username, const char *groupname);
void daemon_close_log(void);
void log_welcome(const char *whoami);
void drop_privileges_or_die(const char *username, const char *groupname);
-/** used for server_uptime() */
-void set_server_start_time(const struct timeval *startuptime);
+void set_server_start_time(void);
time_t get_server_uptime(const struct timeval *current_time);
__malloc char *get_server_uptime_str(const struct timeval *current_time);
void daemon_set_logfile(char *logfile_name);
time_t get_server_uptime(const struct timeval *current_time);
__malloc char *get_server_uptime_str(const struct timeval *current_time);
void daemon_set_logfile(char *logfile_name);
parse_config_or_die(0);
log_welcome("para_server");
init_ipc_or_die(); /* init mmd struct and mmd->lock */
parse_config_or_die(0);
log_welcome("para_server");
init_ipc_or_die(); /* init mmd struct and mmd->lock */
- /* make sure, the global now pointer is uptodate */
- clock_get_realtime(now);
- set_server_start_time(now);
+ set_server_start_time();
init_user_list(user_list_file);
/* become daemon */
if (conf.daemon_given)
init_user_list(user_list_file);
/* become daemon */
if (conf.daemon_given)