Patch calc_rel_weekday_after_month_year for Date/time related Bug #55015
Patch version 2011-07-06 06:08 UTC
Return to Bug #55015 |
Download this patch
Patch Revisions:
Developer: lonnyk@gmail.com
Index: ext/date/lib/tm2unixtime.c
===================================================================
--- ext/date/lib/tm2unixtime.c (revision 312976)
+++ ext/date/lib/tm2unixtime.c (working copy)
@@ -192,19 +192,22 @@
static void do_adjust_relative(timelib_time* time)
{
- if (time->relative.have_weekday_relative) {
- do_adjust_for_weekday(time);
- }
- do_normalize(time);
-
if (time->have_relative) {
time->s += time->relative.s;
time->i += time->relative.i;
time->h += time->relative.h;
- time->d += time->relative.d;
time->m += time->relative.m;
time->y += time->relative.y;
+
+ if (time->relative.have_weekday_relative) {
+ /* Relative weekdays are calculated after we change month/year b/c weekdays change every month/yr. */
+ do_normalize(time);
+ do_adjust_for_weekday(time);
+ do_normalize(time);
+ }
+
+ time->d += time->relative.d;
}
switch (time->relative.first_last_day_of) {
case 1: /* first */
|