summaryrefslogtreecommitdiff
path: root/debian/patches/dyson-tm_gmtoff.patch
blob: 1f3f5a540714b5bf24c0775901a928105fa3d9d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Description: tm_gmtoff may be missed
Index: knot/configure.ac
===================================================================
--- knot.orig/configure.ac	2014-05-24 14:03:58.107975376 +0400
+++ knot/configure.ac	2014-05-24 14:45:02.032197698 +0400
@@ -324,6 +324,8 @@
 AC_TYPE_SIZE_T
 AC_TYPE_SSIZE_T
 
+AC_CHECK_MEMBERS([struct tm.tm_gmtoff], [], [], [#include <time.h>])
+
 # Checks for library functions.
 AC_CHECK_FUNCS([clock_gettime gettimeofday fgetln getline madvise malloc_trim poll posix_memalign pselect pthread_setaffinity_np regcomp select setgroups initgroups])
 
Index: knot/src/common/log.c
===================================================================
--- knot.orig/src/common/log.c	2014-05-24 14:03:58.202982325 +0400
+++ knot/src/common/log.c	2014-05-24 15:03:02.507965836 +0400
@@ -216,7 +216,9 @@
 	struct timeval tv;
 	gettimeofday(&tv, NULL);
 	time_t sec = tv.tv_sec;
-	if (localtime_r(&sec, &lt) != NULL) {
+	struct tm *r = localtime_r(&sec, &lt);
+#ifdef HAVE_STRUCT_TM_TM_GMTOFF
+	if (r) {
 		bool precise = false;
 
 #ifdef ENABLE_MICROSECONDS_LOG
@@ -234,6 +236,7 @@
 			         (unsigned int)(lt.tm_gmtoff / 60) % 60);
 		}
 	}
+#endif /* HAVE_STRUCT_TM_TM_GMTOFF */
 
 	// Log streams
 	for (int i = LOGT_STDERR; i < LOGT_FILE + LOG_FDS_OPEN; ++i) {