Skip to content
Snippets Groups Projects
Commit 1555aefd authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Check that the required system functions are present at configure time

parent b3e9532a
No related branches found
No related tags found
2 merge requests!136Master,!107Code timing and verbosity
......@@ -329,7 +329,7 @@ is defined in <sys/time.h>])],,
[#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif])
AC_CHECK_FUNCS([gethrtime read_real_time time_base_to_time clock_gettime mach_absolute_time])
AC_CHECK_FUNCS([gethrtime read_real_time time_base_to_time clock_gettime mach_absolute_time strftime gettimeofday localtime])
AC_MSG_CHECKING([for _rtc intrinsic])
rtc_ok=yes
AC_LINK_IFELSE([AC_LANG_PROGRAM(
......
......@@ -222,8 +222,17 @@ double clocks_from_ticks(ticks tics) {
*/
const char *clocks_getunit() { return clocks_units[clocks_units_index]; }
/**
* @brief returns a string containing the local date and time
*
* The date is return in the format [YYYY-MM-DD hh:mm:ss]
*
* @result the current time.
*/
const char *clocks_get_timeofday() {
#if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_LOCALTIME) && \
defined(HAVE_STRFTIME)
struct timeval time;
struct tm *local_time;
static char buffer[40];
......@@ -235,5 +244,8 @@ const char *clocks_get_timeofday() {
/* Make it a string */
strftime(buffer, 40, "[%F %T]", local_time);
#else
static char buffer[40] = "[Unknown time]";
#endif
return buffer;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment