From f4ffd9fa72eda3ad070cdabb0390978c5fa5528c Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Thu, 3 Apr 2008 05:34:12 +0000 Subject: applied patch from Peter Pawlowski fixing a timezone offset problem, fixes * libexslt/date.c: applied patch from Peter Pawlowski fixing a timezone offset problem, fixes #521680 * libxslt/namespaces.c: a bit of space/tabs cleanup Daniel svn path=/trunk/; revision=1462 --- ChangeLog | 6 ++++++ doc/xsltproc.1 | 4 ++-- libexslt/date.c | 32 +++++++++++++++++++++++++++----- libxslt/namespaces.c | 8 ++++---- 4 files changed, 39 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index f0376985..716f0cb9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Apr 3 07:32:36 CEST 2008 Daniel Veillard + + * libexslt/date.c: applied patch from Peter Pawlowski fixing + a timezone offset problem, fixes #521680 + * libxslt/namespaces.c: a bit of space/tabs cleanup + Thu Apr 3 06:25:02 CEST 2008 Daniel Veillard * doc/xsltproc.xml doc/xsltproc.1 doc/xsltproc.html: small fix to diff --git a/doc/xsltproc.1 b/doc/xsltproc.1 index a766fab4..e711c818 100644 --- a/doc/xsltproc.1 +++ b/doc/xsltproc.1 @@ -1,11 +1,11 @@ .\" Title: xsltproc .\" Author: John Fleck .\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: $Date: 2008-03-03 09:42:08 +0100 (Mon, 03 Mar 2008) $ +.\" Date: $Date: 2008-04-03 06:26:46 +0200 (Thu, 03 Apr 2008) $ .\" Manual: xsltproc Manual .\" Source: libxslt .\" -.TH "XSLTPROC" "1" "$Date: 2008\-03\-03 09:42:08 +0100 (Mon, 03 Mar 2008) $" "libxslt" "xsltproc Manual" +.TH "XSLTPROC" "1" "$Date: 2008\-04\-03 06:26:46 +0200 (Thu, 03 Apr 2008) $" "libxslt" "xsltproc Manual" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) diff --git a/libexslt/date.c b/libexslt/date.c index 1127e18a..c0977add 100644 --- a/libexslt/date.c +++ b/libexslt/date.c @@ -747,7 +747,8 @@ static exsltDateValPtr exsltDateCurrent (void) { struct tm *localTm, *gmTm; - time_t secs, gsecs; + time_t secs; + int local_s, gm_s; #if HAVE_LOCALTIME_R struct tm localTmS; #endif @@ -795,9 +796,30 @@ exsltDateCurrent (void) ((gmTm->tm_mday * 1440) + (gmTm->tm_hour * 60) + gmTm->tm_min)); #endif - gsecs = mktime(gmTm); - ret->value.date.tzo = (secs - gsecs) / 60; - + local_s = localTm->tm_hour * SECS_PER_HOUR + + localTm->tm_min * SECS_PER_MIN + + localTm->tm_sec; + + gm_s = gmTm->tm_hour * SECS_PER_HOUR + + gmTm->tm_min * SECS_PER_MIN + + gmTm->tm_sec; + + if (localTm->tm_year < gmTm->tm_year) { + ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60; + } else if (localTm->tm_year > gmTm->tm_year) { + ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60; + } else if (localTm->tm_mon < gmTm->tm_mon) { + ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60; + } else if (localTm->tm_mon > gmTm->tm_mon) { + ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60; + } else if (localTm->tm_mday < gmTm->tm_mday) { + ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60; + } else if (localTm->tm_mday > gmTm->tm_mday) { + ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60; + } else { + ret->value.date.tzo = (local_s - gm_s)/60; + } + return ret; } #endif @@ -2158,7 +2180,7 @@ exsltDateWeekInYear (const xmlChar *dateTime) /* ISO 8601 adjustment, 3 is Thu */ diy += (3 - diw); - if(diy < 1) { + if (diy < 1) { year = dt->value.date.year - 1; if(year == 0) year--; diy = DAY_IN_YEAR(31, 12, year) + diy; diff --git a/libxslt/namespaces.c b/libxslt/namespaces.c index 6c72746b..b147df8f 100644 --- a/libxslt/namespaces.c +++ b/libxslt/namespaces.c @@ -546,7 +546,7 @@ xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode, * Hmm, we could also try to reuse an in-scope * namespace with a matching ns-name but a different * ns-prefix. - * What has higher priority? + * What has higher priority? * 1) If keeping the prefix: create a new ns-decl. * 2) If reusal: first lookup ns-names; then fallback * to creation of a new ns-decl. @@ -583,13 +583,13 @@ declare_new_prefix: { xmlChar pref[30]; int counter = 1; - + do { snprintf((char *) pref, 30, "%s_%d", nsPrefix, counter++); ns = xmlSearchNs(target->doc, target, BAD_CAST pref); if (counter > 1000) { xsltTransformError(ctxt, NULL, invocNode, - "Internal error in xsltAcquireResultInScopeNs(): " + "Internal error in xsltAcquireResultInScopeNs(): " "Failed to compute a unique ns-prefix for the " "generated element"); return(NULL); @@ -599,7 +599,7 @@ declare_new_prefix: /* TODO: Check result */ return(ns); } - return(NULL); + return(NULL); } /** -- cgit v1.2.1