summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt9
-rw-r--r--config.h.in1
-rw-r--r--src/libutil/util.c9
3 files changed, 19 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1ba6e7672..865bef735 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -920,6 +920,15 @@ CHECK_C_SOURCE_COMPILES(
int main(int argc, char** argv) {
return cmkcheckweak == NULL;
}" HAVE_WEAK_SYMBOLS)
+CHECK_C_SOURCE_COMPILES(
+ "#include <time.h>
+ extern char *tzname[2];
+ extern long timezone;
+ extern int daylight;
+ int main(int argc, char** argv) {
+ tzset();
+ return timezone;
+ }" HAVE_SANE_TZSET)
IF(WITH_ICONV)
CHECK_C_SOURCE_COMPILES("
diff --git a/config.h.in b/config.h.in
index 402d410f1..aa875534d 100644
--- a/config.h.in
+++ b/config.h.in
@@ -75,6 +75,7 @@
#cmakedefine HAVE_READPASSPHRASE_H 1
#cmakedefine HAVE_SA_SIGINFO 1
#cmakedefine HAVE_SANE_SHMEM 1
+#cmakedefine HAVE_SANE_TZSET 1
#cmakedefine HAVE_SCHED_YEILD 1
#cmakedefine HAVE_SC_NPROCESSORS_ONLN 1
#cmakedefine HAVE_SEARCH_H 1
diff --git a/src/libutil/util.c b/src/libutil/util.c
index 5e271ed80..d1500b54a 100644
--- a/src/libutil/util.c
+++ b/src/libutil/util.c
@@ -2762,6 +2762,7 @@ rspamd_gmtime (gint64 ts, struct tm *dest)
dest->tm_zone = "GMT";
}
+#ifdef HAVE_SANE_TZSET
extern char *tzname[2];
extern long timezone;
extern int daylight;
@@ -2784,6 +2785,14 @@ void rspamd_localtime (gint64 ts, struct tm *dest)
#endif
}
+#else
+void rspamd_localtime (gint64 ts, struct tm *dest)
+{
+ time_t t = ts;
+ localtime_r (&t, dest);
+}
+#endif
+
gboolean
rspamd_fstring_gzip (rspamd_fstring_t **in)
{