Re: Can't compile SWI on FreeBSD
- From: "Darren Bane" <darren.bane@xxxxxxxxx>
- Date: 25 Sep 2006 04:43:08 -0700
Jan Wielemaker wrote:
!snip!
Somehow I got a mail from this service, but it requires a password :-(
If there is a solution in the ticket, please post it here or send it
by mail.
Sorry about that, I thought that system was readable by the public
without registration.
Here's the patch:
--- pl-tai.c.orig Thu Aug 10 16:52:22 2006
+++ pl-tai.c Thu Aug 10 16:56:19 2006
@@ -22,14 +22,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA
*/
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
-Somehow, MacOS X defines timezone() as a function. Using the
#define
-__DARWIN_UNIX03 1 is reverts to the standard behaviour to make it
an
-long set by tzset(). Not really clean ...
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - */
-
-#define __DARWIN_UNIX03 1
-
#include <math.h>
#include "pl-incl.h"
#include "libtai/taia.h"
@@ -41,8 +33,6 @@
#define daylight _daylight
#else
extern char *tzname[2];
-extern long timezone;
-extern int daylight;
#endif
@@ -82,8 +72,24 @@
static int
tz_offset()
-{ do_tzset();
- return timezone;
+{ time_t tloc;
+ struct tm result;
+
+ tloc = time(NULL);
+ return localtime_r(&tloc, &result)->tm_gmtoff;
+}
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
+tz_daylight() tests whether summer time is in effect.
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - */
+
+static int
+tz_daylight()
+{ time_t tloc;
+ struct tm result;
+
+ tloc = time(NULL);
+ return localtime_r(&tloc, &result)->tm_isdst;
}
@@ -312,7 +318,7 @@
ct.hour = tm.tm_hour;
ct.minute = tm.tm_min;
tzatom = tz_name_as_atom(tm.tm_isdst);
- if ( daylight ) /* from tzset() */
+ if ( tz_daylight() ) /* from tzset() */
{ if ( tm.tm_isdst )
{ utcoffset -= 3600;
dstatom = ATOM_true;
@@ -721,7 +727,7 @@
{ localtime_r(&unixt, &tb.tm);
tb.sec = (double)tb.tm.tm_sec + modf(tb.stamp, &ip);
tb.utcoff = tz_offset();
- if ( daylight )
+ if ( tz_daylight() )
{ if ( tb.tm.tm_isdst )
{ tb.utcoff -= 3600;
tb.isdst = TRUE;
.
- Follow-Ups:
- Re: Can't compile SWI on FreeBSD
- From: Jan Wielemaker
- Re: Can't compile SWI on FreeBSD
- References:
- Can't compile SWI on FreeBSD
- From: Mike Goodrich
- Re: Can't compile SWI on FreeBSD
- From: Jan Wielemaker
- Re: Can't compile SWI on FreeBSD
- From: Darren Bane
- Re: Can't compile SWI on FreeBSD
- From: Jan Wielemaker
- Can't compile SWI on FreeBSD
- Prev by Date: Re: Can't compile SWI on FreeBSD
- Next by Date: Re: Can't compile SWI on FreeBSD
- Previous by thread: Re: Can't compile SWI on FreeBSD
- Next by thread: Re: Can't compile SWI on FreeBSD
- Index(es):
Relevant Pages
|