libxslt r1466 - trunk/libexslt
- From: veillard svn gnome org
- To: svn-commits-list gnome org
- Subject: libxslt r1466 - trunk/libexslt
- Date: Tue, 8 Apr 2008 18:05:42 +0100 (BST)
Author: veillard
Date: Tue Apr 8 18:05:41 2008
New Revision: 1466
URL: http://svn.gnome.org/viewvc/libxslt?rev=1466&view=rev
Log:
add back #452876 patch lost on previous commit, Daniel
Modified:
trunk/libexslt/date.c
Modified: trunk/libexslt/date.c
==============================================================================
--- trunk/libexslt/date.c (original)
+++ trunk/libexslt/date.c Tue Apr 8 18:05:41 2008
@@ -2143,7 +2143,7 @@
exsltDateWeekInYear (const xmlChar *dateTime)
{
exsltDateValPtr dt;
- long fdiy, fdiw, ret;
+ long diy, diw, year, ret;
if (dateTime == NULL) {
#ifdef WITH_TIME
@@ -2161,20 +2161,26 @@
}
}
- fdiy = DAY_IN_YEAR(1, 1, dt->value.date.year);
-
+ diy = DAY_IN_YEAR(dt->value.date.day, dt->value.date.mon,
+ dt->value.date.year);
+
/*
* Determine day-in-week (0=Sun, 1=Mon, etc.) then adjust so Monday
* is the first day-in-week
*/
- fdiw = (_exsltDateDayInWeek(fdiy, dt->value.date.year) + 6) % 7;
-
- ret = (DAY_IN_YEAR(dt->value.date.day, dt->value.date.mon,
- dt->value.date.year) + fdiw) / 7;
+ diw = (_exsltDateDayInWeek(diy, dt->value.date.year) + 6) % 7;
/* ISO 8601 adjustment, 3 is Thu */
- if (fdiw <= 3)
- ret += 1;
+ diy += (3 - diw);
+ if(diy < 1) {
+ year = dt->value.date.year - 1;
+ if(year == 0) year--;
+ diy = DAY_IN_YEAR(31, 12, year) + diy;
+ } else if (diy > DAY_IN_YEAR(31, 12, dt->value.date.year)) {
+ diy -= DAY_IN_YEAR(31, 12, dt->value.date.year);
+ }
+
+ ret = ((diy - 1) / 7) + 1;
exsltDateFreeDate(dt);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]