applied patch from Peter Pawlowski fixing a timezone offset problem, fixes
authorDaniel Veillard <veillard@src.gnome.org>
Thu, 3 Apr 2008 05:34:12 +0000 (05:34 +0000)
committerDaniel Veillard <veillard@src.gnome.org>
Thu, 3 Apr 2008 05:34:12 +0000 (05:34 +0000)
* 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
doc/xsltproc.1
libexslt/date.c
libxslt/namespaces.c

index f037698..716f0cb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Apr  3 07:32:36 CEST 2008 Daniel Veillard <daniel@veillard.com>
+
+       * 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 <daniel@veillard.com>
 
        * doc/xsltproc.xml doc/xsltproc.1 doc/xsltproc.html: small fix to
index a766fab..e711c81 100644 (file)
@@ -1,11 +1,11 @@
 .\"     Title: xsltproc
 .\"    Author: John Fleck <jfleck@inkstain.net>
 .\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      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)
index 1127e18..c0977ad 100644 (file)
@@ -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;
index 6c72746..b147df8 100644 (file)
@@ -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);
 }
 
 /**