Re: [xslt] Fail build of OpenBSD
- From: Charlie Bozeman <cbozeman HiWAAY net>
- To: xslt gnome org
- Subject: Re: [xslt] Fail build of OpenBSD
- Date: Sat, 18 Aug 2001 09:59:20 -0500
I had the same problem in cygwin; I just changed timezone to _timezone
to get it to compile.
I am in the process of implementing the EXSLT date funtions and ran into
the same problem between cygwin at work and linux at home. Here is a
snippet of code that illustrates how I get the timezone offset:
{
struct tm *pLocalTm;
struct tm *pGmTm;
time_t tzSecs; /* timezone offset in seconds */
time_t secs;
newDate->format = format;
/* get current time */
secs = time(NULL);
pLocalTm = localtime(&secs);
memcpy(&newDate->tm, pLocalTm, sizeof(struct tm));
/* get real year, not years since 1900 */
newDate->year = newDate->tm.tm_year + 1900;
/* determine the time zone offset from local to gm time */
pGmTm = gmtime(&secs);
tzSecs = mktime(pGmTm) - secs;
This is a little inefficient so a portable solution using a variable
that holds the offset (_timzone or timezone) would be welcome.
Daniel Veillard wrote:
>
> On Sat, Aug 18, 2001 at 11:55:07AM +0000, Bjorn Reese wrote:
> > Daniel Veillard wrote:
> >
> > > They are both defined as
> > > time_t gmt, lmt;
> > >
> > > Isn't time_t supposed to be a scalar type ?
> >
> > Yes, it is defined as an arithmetic type, but I think that the problem
> > is 'timezone' (which is part of the X/Open standard, but neither ISO C
> > nor POSIX).
> >
> > The OpenBSD man page on localtime() does not mention the 'timezone'
> > variable. Instead it has tm_gmtoff in struct tm, which is described as
> > "the offset (in seconds) of the time represented from UTC, with positive
> > values indicating east of the Prime Meridian."
> >
> > Ah, the joys of portability :)
>
> yes <sigh/>
>
> Well, this function is not critical at all (it's a specific function
> for Norman Walsh stylesheets), if we have a reliable way to detect
> that the 'timezone' variable is not available, simply don't compile and
> register this function,
>
> Daniel
>
> --
> Daniel Veillard | Red Hat Network http://redhat.com/products/network/
> veillard@redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
> http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
>
> _______________________________________________
> xslt mailing list
> xslt@gnome.org
> http://mail.gnome.org/mailman/listinfo/xslt
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]