diff --git a/configure.ac b/configure.ac index cf1827cf..57454443 100644 --- a/configure.ac +++ b/configure.ac @@ -74,7 +74,8 @@ AC_CHECK_FUNCS([memset strchr strerror strrchr mkdir gettimeofday strtoul]) AC_CHECK_FUNCS([getopt getopt_long snprintf vsnprintf]) AC_CHECK_FUNCS([ftruncate fallocate fsync access posix_fallocate posix_fadvise]) AC_CHECK_FUNCS([pread pwrite getc_unlocked ferror_unlocked fnmatch]) -AC_CHECK_FUNCS([futimes futimens futimesat fstatat flock statfs]) +AC_CHECK_FUNCS([futimes futimens futimesat localtime_r]) +AC_CHECK_FUNCS([fstatat flock statfs]) dnl Checks for architecture AC_C_BIGENDIAN diff --git a/list.c b/list.c index e1cad28f..ed3a3fc4 100644 --- a/list.c +++ b/list.c @@ -48,7 +48,9 @@ void state_list(struct snapraid_state* state) /* for each file */ for(j=disk->filelist;j!=0;j=j->next) { struct snapraid_file* file = j->data; +#if HAVE_LOCALTIME_R struct tm tm_res; +#endif struct tm* tm; time_t t; @@ -58,7 +60,11 @@ void state_list(struct snapraid_state* state) fprintf(stdlog, "file:%s:%s:%"PRIu64":%"PRIi64":%u:%"PRIi64"\n", disk->name, file->sub, file->size, file->mtime_sec, file->mtime_nsec, file->inode); t = file->mtime_sec; +#if HAVE_LOCALTIME_R tm = localtime_r(&t, &tm_res); +#else + tm = localtime(&t); +#endif printf("%12"PRIu64" ", file->size); if (tm) {