projects
/
mmh
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a0efe79
)
Undid most of 3ef341abe440ece07f8deed59fb026ab020e805 because FreeBSD needs the HAVE_...
author
David Levine
<levinedl@acm.org>
Thu, 26 Jan 2012 01:33:17 +0000
(19:33 -0600)
committer
David Levine
<levinedl@acm.org>
Thu, 26 Jan 2012 01:33:17 +0000
(19:33 -0600)
configure.ac
patch
|
blob
|
history
sbr/dtime.c
patch
|
blob
|
history
diff --git
a/configure.ac
b/configure.ac
index
0756158
..
d73f376
100644
(file)
--- a/
configure.ac
+++ b/
configure.ac
@@
-716,6
+716,11
@@
dnl ----------------
dnl CHECK STRUCTURES
dnl ----------------
dnl CHECK STRUCTURES
dnl ----------------
+dnl For platforms such as FreeBSD that have tm_gmtoff in struct tm.
+dnl (FreeBSD has a timezone() function but not a timezone global
+dnl variable that is visible).
+AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>])
+
AC_STRUCT_DIRENT_D_TYPE
dnl Where is <signal.h> located? Needed as input for signames.awk
AC_STRUCT_DIRENT_D_TYPE
dnl Where is <signal.h> located? Needed as input for signames.awk
diff --git
a/sbr/dtime.c
b/sbr/dtime.c
index
aa34621
..
a7c1574
100644
(file)
--- a/
sbr/dtime.c
+++ b/
sbr/dtime.c
@@
-12,6
+12,10
@@
#include <h/tws.h>
#include <time.h>
#include <h/tws.h>
#include <time.h>
+#if !defined(HAVE_STRUCT_TM_TM_GMTOFF)
+extern long timezone;
+#endif
+
/*
* The number of days in the year, accounting for leap years
*/
/*
* The number of days in the year, accounting for leap years
*/
@@
-99,8
+103,14
@@
dlocaltime (time_t *clock)
if (tm->tm_isdst)
tw.tw_flags |= TW_DST;
if (tm->tm_isdst)
tw.tw_flags |= TW_DST;
+#ifdef HAVE_STRUCT_TM_TM_GMTOFF
+ tw.tw_zone = tm->tm_gmtoff / 60;
+ if (tm->tm_isdst) /* if DST is in effect */
+ tw.tw_zone -= 60; /* reset to normal offset */
+#else
tzset();
tw.tw_zone = -(timezone / 60);
tzset();
tw.tw_zone = -(timezone / 60);
+#endif
tw.tw_flags &= ~TW_SDAY;
tw.tw_flags |= TW_SEXP;
tw.tw_flags &= ~TW_SDAY;
tw.tw_flags |= TW_SEXP;