diff options
Diffstat (limited to 'comms/gammu/files/patch-daylight.diff')
-rw-r--r-- | comms/gammu/files/patch-daylight.diff | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/comms/gammu/files/patch-daylight.diff b/comms/gammu/files/patch-daylight.diff new file mode 100644 index 000000000000..92edf91fd63e --- /dev/null +++ b/comms/gammu/files/patch-daylight.diff @@ -0,0 +1,86 @@ +From 3b18e8d86c2840df2c1d5b94760f7f9a98bacd6d Mon Sep 17 00:00:00 2001 +From: =?utf-8?q?Michal=20=C4=8Ciha=C5=99?= <mcihar@novell.com> +Date: Fri, 28 Jan 2011 13:51:21 +0100 +Subject: [PATCH] Check for daylight variable and use it only if available. + +--- + CMakeLists.txt | 10 ++++++++++ + cmake/templates/gammu-config.h.cmake | 7 +++++++ + libgammu/misc/misc.c | 4 ++++ + smsd/services/sql.c | 4 ++++ + 4 files changed, 25 insertions(+), 0 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3460c1c..899ad86 100644 +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -295,6 +295,16 @@ int main(void) { + " HAVE_STRUCT_TM_TM_ZONE) + + check_c_source_compiles (" ++#include <time.h> ++ ++int main(void) { ++ struct tm tm; ++ tm.tm_isdst = daylight; ++ return 0; ++} ++" HAVE_DAYLIGHT) ++ ++check_c_source_compiles (" + #include <stdio.h> + + int main(void) { +diff --git a/cmake/templates/gammu-config.h.cmake b/cmake/templates/gammu-config.h.cmake +index 7c106ab..9a91aa0 100644 +--- cmake/templates/gammu-config.h.cmake ++++ cmake/templates/gammu-config.h.cmake +@@ -325,6 +325,13 @@ + #endif + + /** ++ * daylight variable ++ */ ++#ifndef HAVE_DAYLIGHT ++#cmakedefine HAVE_DAYLIGHT ++#endif ++ ++/** + * __FUNC__ support + */ + #cmakedefine HAVE_MACRO_FUNC +diff --git a/libgammu/misc/misc.c b/libgammu/misc/misc.c +index 03d7687..9e1e96b 100644 +--- libgammu/misc/misc.c ++++ libgammu/misc/misc.c +@@ -194,7 +194,11 @@ time_t Fill_Time_T(GSM_DateTime DT) + + tzset(); + ++#ifdef HAVE_DAYLIGHT + tm_starttime.tm_isdst = daylight; ++#else ++ tm_starttime.tm_isdst = -1; ++#endif + #ifdef HAVE_STRUCT_TM_TM_ZONE + /* No time zone information */ + tm_starttime.tm_gmtoff = timezone; +diff --git a/smsd/services/sql.c b/smsd/services/sql.c +index f10cd14..909dc4d 100644 +--- smsd/services/sql.c ++++ smsd/services/sql.c +@@ -1186,7 +1186,11 @@ time_t SMSDSQL_ParseDate(GSM_SMSDConfig * Config, const char *date) + + tzset(); + ++#ifdef HAVE_DAYLIGHT + timestruct.tm_isdst = daylight; ++#else ++ timestruct.tm_isdst = -1; ++#endif + #ifdef HAVE_STRUCT_TM_TM_ZONE + /* No time zone information */ + timestruct.tm_gmtoff = timezone; +-- +1.6.1 + |