fixed end-of-month problem in exsltDateCurrent (#359246)
authorWilliam M. Brack <wbrack@src.gnome.org>
Thu, 12 Oct 2006 15:15:26 +0000 (15:15 +0000)
committerWilliam M. Brack <wbrack@src.gnome.org>
Thu, 12 Oct 2006 15:15:26 +0000 (15:15 +0000)
* libexslt/date.c: fixed end-of-month problem in exsltDateCurrent
  (#359246)

ChangeLog
libexslt/date.c

index ace4211..567d782 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Oct 12 23:12:24 HKT 2006 William Brack <wbrack@mmm.com.hk>
+
+       * libexslt/date.c: fixed end-of-month problem in exsltDateCurrent
+         (#359246)
+
 Thu Oct 12 14:39:37 CEST 2006 Daniel Veillard <daniel@veillard.com>
 
        * libxslt/preproc.c: applied patch from Mike Hommey fixing 2 
index 59ca136..22a2cc1 100644 (file)
@@ -746,7 +746,7 @@ static exsltDateValPtr
 exsltDateCurrent (void)
 {
     struct tm *localTm, *gmTm;
-    time_t secs;
+    time_t secs, gsecs;
 #if HAVE_LOCALTIME_R
     struct tm localTmS;
 #endif
@@ -787,11 +787,15 @@ exsltDateCurrent (void)
     gmTm = gmtime(&secs);
 #endif
     ret->value.date.tz_flag = 0;
+#if 0
     ret->value.date.tzo = (((ret->value.date.day * 1440) +
                             (ret->value.date.hour * 60) +
                              ret->value.date.min) -
                            ((gmTm->tm_mday * 1440) + (gmTm->tm_hour * 60) +
                              gmTm->tm_min));
+#endif
+    gsecs = mktime(gmTm);
+    ret->value.date.tzo = (secs - gsecs) / 60;
 
     return ret;
 }