Re: Can't compile SWI on FreeBSD



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;

.



Relevant Pages

  • Re: Timezone conversion
    ... I've been using the ToUniversalTime object with great success until we moved ... the clocks forward for daylight savins time. ... Now, ToUniversalTime shows UTC ... There is a TimeZone class, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Getting Timezone Data
    ... I'm trying to devise a portable function for retrtieving timezone ... Note that the variable daylight does not indicate that daylight saving ...
    (comp.unix.programmer)
  • Re: Getting Timezone Data
    ... I'm trying to devise a portable function for retrtieving timezone ... Note that the variable daylight does not indicate that daylight saving ...
    (comp.unix.programmer)
  • RE: How to cycle SMTP?
    ... I want to be sure to get the TIMEZONE updated next month when Daylight ... Saving Time starts in the USA. ... For IBM-MAIN subscribe / signoff / archive access instructions, ...
    (bit.listserv.ibm-main)