diff --git a/configure.ac b/configure.ac
index 6abf5a35bb102c6bcfd1716b2506a4ed0ec82905..719b5e689701828070cf6923eda00d6acc543aa0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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(
diff --git a/src/clocks.c b/src/clocks.c
index 20152c07d103e7cf7f1dd9620e196a8aefd4389f..d572e9d85025e6bf78474f36f99eae0654f1c99b 100644
--- a/src/clocks.c
+++ b/src/clocks.c
@@ -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;
 }