/*
- * Copyright (C) 1997-2013 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 1997-2014 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
#include <pwd.h>
#include <sys/types.h> /* getgrnam() */
#include <grp.h>
-#include <sys/time.h>
#include <signal.h>
#include "para.h"
/**
* 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);
}
/**
fprintf(fp, "%s", color);
if (log_time || log_timing) {
struct timeval tv;
- gettimeofday(&tv, NULL);
+ clock_get_realtime(&tv);
if (daemon_test_flag(DF_LOG_TIME)) { /* print date and time */
time_t t1 = tv.tv_sec;
char str[100];