Dynamic Interval Recurring Holidays Off By +1 Yr

General support regarding TimeTrex, such as
configuring policies/taxes or processing payroll.
Post Reply
dhbarr
Posts: 7
Joined: Tue Dec 18, 2007 10:50 am
Location: OKC, OK, USA
Contact:

Dynamic Interval Recurring Holidays Off By +1 Yr

Post by dhbarr »

In reverse order of "How to Ask for Help"
http://forums.timetrex.com/viewtopic.php?t=89


8. From D:\timetrex\timetrex\timetrex.ini.php:

[debug]
production = FALSE
enable = TRUE
enable_display = TRUE
buffer_output = TRUE
enable_log = TRUE
verbosity = 11


7. From D:\timetrex\php\php.ini:

error_reporting = E_ALL
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
;report_zend_debug = 0
track_errors = Off
;html_errors = Off
;docref_root = "/phpmanual/"
;docref_ext = .html
;error_prepend_string = "<font color=ff0000>"
;error_append_string = "</font>"
error_log = php_error_log.txt
;error_log = syslog


6,5,4,3.
Windows Server 2003 R2 Standard Edition (32 bit)
TimeTrex_Standard_Edition_v2.1.3-windows-installer
Apache.exe 2.0.59.200
PHP.exe 5.2.4.4
TimeTrex Standard 2.1.3


2. Steps to Reproduce:
Log in to fresh TimeTrex install
Browse to Admin -> Company -> Recurring Holidays
Sort Recurring Holiday List By Next Date Ascending
Good Friday 03/20/2008
Memorial Day 05/26/2008
Independence Day 07/04/2008
July 4th 07/04/2008
Veterans Day 11/11/2008
Christmas 12/25/2008
New Years Day 01/01/2009
Martin Luther King Day 01/19/2009
Presidents Day 02/16/2009
Labor Day 09/07/2009
Columbus Day 10/12/2009
Thanksgiving Day 11/26/2009


1. MLK, Presidents, Labor, Columbus, and Thanksgiving are +1 year.
Static holidays appear to be correct.
Dynamic-interval holidays appear to be incorrect.
Dynamic-pivot holidays appear to be correct.


0. Potentially relevant debug output
DEBUG [566]: Factory::getSortSQL(): Invalid Sort Column/Order: next_date Order: asc
DEBUG [380]: RecurringHolidayFactory::getNextDate(): Static Date...
DEBUG [449]: RecurringHolidayFactory::getNextDate(): Next Date for: New Years Day is: 01/01/2009 12:00 pm
DEBUG [380]: RecurringHolidayFactory::getNextDate(): Static Date...
DEBUG [449]: RecurringHolidayFactory::getNextDate(): Next Date for: Independence Day is: 07/04/2008 12:00 pm
DEBUG [380]: RecurringHolidayFactory::getNextDate(): Static Date...
DEBUG [449]: RecurringHolidayFactory::getNextDate(): Next Date for: Veterans Day is: 11/11/2008 12:00 pm
DEBUG [380]: RecurringHolidayFactory::getNextDate(): Static Date...
DEBUG [449]: RecurringHolidayFactory::getNextDate(): Next Date for: Christmas is: 12/25/2008 12:00 pm
DEBUG [380]: RecurringHolidayFactory::getNextDate(): Static Date...
DEBUG [449]: RecurringHolidayFactory::getNextDate(): Next Date for: July 4th is: 07/04/2008 12:00 pm
DEBUG [387]: RecurringHolidayFactory::getNextDate(): Dynamic - Week Interval... Current Month: 1 Holiday Month: 1
DEBUG [393]: RecurringHolidayFactory::getNextDate(): Start Epoch: 01/07/2008 3:31 pm End Epoch: 02/01/2009 12:00 pm
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1199741516 Day Of Month: 7
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1200346316 Day Of Month: 14
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1200951116 Day Of Month: 21
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1201555916 Day Of Month: 28
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1231191116 Day Of Month: 5
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1231795916 Day Of Month: 12
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1232400716 Day Of Month: 19
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1233005516 Day Of Month: 26
DEBUG [449]: RecurringHolidayFactory::getNextDate(): Next Date for: Martin Luther King Day is: 01/19/2009 12:00 pm
DEBUG [387]: RecurringHolidayFactory::getNextDate(): Dynamic - Week Interval... Current Month: 1 Holiday Month: 2
DEBUG [393]: RecurringHolidayFactory::getNextDate(): Start Epoch: 01/07/2008 3:31 pm End Epoch: 03/01/2009 12:00 pm
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1202160716 Day Of Month: 4
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1202765516 Day Of Month: 11
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1203370316 Day Of Month: 18
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1203975116 Day Of Month: 25
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1233610316 Day Of Month: 2
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1234215116 Day Of Month: 9
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1234819916 Day Of Month: 16
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1235424716 Day Of Month: 23
DEBUG [449]: RecurringHolidayFactory::getNextDate(): Next Date for: Presidents Day is: 02/16/2009 12:00 pm
DEBUG [413]: RecurringHolidayFactory::getNextDate(): Dynamic - Pivot Date...
DEBUG [441]: RecurringHolidayFactory::getNextDate(): X: 0 aTrying...05/25/2008 12:00 pm
DEBUG [449]: RecurringHolidayFactory::getNextDate(): Next Date for: Memorial Day is: 05/26/2008 12:00 pm
DEBUG [387]: RecurringHolidayFactory::getNextDate(): Dynamic - Week Interval... Current Month: 1 Holiday Month: 9
DEBUG [393]: RecurringHolidayFactory::getNextDate(): Start Epoch: 01/07/2008 3:31 pm End Epoch: 10/01/2009 12:00 pm
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1220304716 Day Of Month: 1
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1220909516 Day Of Month: 8
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1221514316 Day Of Month: 15
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1222119116 Day Of Month: 22
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1222723916 Day Of Month: 29
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1252359116 Day Of Month: 7
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1252963916 Day Of Month: 14
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1253568716 Day Of Month: 21
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1254173516 Day Of Month: 28
DEBUG [449]: RecurringHolidayFactory::getNextDate(): Next Date for: Labor Day is: 09/07/2009 12:00 pm
DEBUG [387]: RecurringHolidayFactory::getNextDate(): Dynamic - Week Interval... Current Month: 1 Holiday Month: 10
DEBUG [393]: RecurringHolidayFactory::getNextDate(): Start Epoch: 01/07/2008 3:31 pm End Epoch: 11/01/2009 12:00 pm
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1223328716 Day Of Month: 6
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1223933516 Day Of Month: 13
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1224538316 Day Of Month: 20
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1225143116 Day Of Month: 27
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1254778316 Day Of Month: 5
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1255383116 Day Of Month: 12
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1255987916 Day Of Month: 19
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1256592716 Day Of Month: 26
DEBUG [449]: RecurringHolidayFactory::getNextDate(): Next Date for: Columbus Day is: 10/12/2009 12:00 pm
DEBUG [387]: RecurringHolidayFactory::getNextDate(): Dynamic - Week Interval... Current Month: 1 Holiday Month: 11
DEBUG [393]: RecurringHolidayFactory::getNextDate(): Start Epoch: 01/07/2008 3:31 pm End Epoch: 12/01/2009 12:00 pm
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1226007116 Day Of Month: 6
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1226611916 Day Of Month: 13
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1227216716 Day Of Month: 20
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1227821516 Day Of Month: 27
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1257456716 Day Of Month: 5
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1258061516 Day Of Month: 12
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1258666316 Day Of Month: 19
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1259271116 Day Of Month: 26
DEBUG [449]: RecurringHolidayFactory::getNextDate(): Next Date for: Thanksgiving Day is: 11/26/2009 12:00 pm
DEBUG [364]: RecurringHolidayFactory::getNextDate(): Easter Sunday Date...
DEBUG [373]: RecurringHolidayFactory::getNextDate(): Good Friday Date...
DEBUG [449]: RecurringHolidayFactory::getNextDate(): Next Date for: Good Friday is: 03/20/2008 12:00 pm
DEBUG [123]: [Function](): Sort By Date!


Questions, Comments, Rebuttals?

-dhbarr.
dhbarr
Posts: 7
Joined: Tue Dec 18, 2007 10:50 am
Location: OKC, OK, USA
Contact:

1/2 of Epoch Calculation Off by + ~1 Year

Post by dhbarr »

It jumped out at me this morning when I went to check on my post that the first half of the epoch stamp calculations listed for Dynamic Intervals in a given month are correct (in the right year) but the second half are incorrect (+ ~1 year). For example...

Code: Select all

DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1199741516 Day Of Month: 7 
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1200346316 Day Of Month: 14 
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1200951116 Day Of Month: 21 
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1201555916 Day Of Month: 28 
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1231191116 Day Of Month: 5 
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1231795916 Day Of Month: 12 
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1232400716 Day Of Month: 19 
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: 1233005516 Day Of Month: 26 
Calculating and substituting gives...

Code: Select all

DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: Monday, January 07, 2008 9:31:56 PM
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: Monday, January 14, 2008 9:31:56 PM
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: Monday, January 21, 2008 9:31:56 PM
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: Monday, January 28, 2008 9:31:56 PM
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: Monday, January 05, 2009 9:31:56 PM
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: Monday, January 12, 2009 9:31:56 PM
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: Monday, January 19, 2009 9:31:56 PM
DEBUG [407]: RecurringHolidayFactory::getNextDate(): I: Monday, January 26, 2009 9:31:56 PM 
The time is obviously accurate -- I'm GMT-6, these epochs are in UTC, and I pulled this page around 3:30 yesterday afternoon. Any idea what could be causing only one-half of the epoch calcs to go astray? BIOS time and Windows System time are both set to local, but surely that can't account for the difference?

-dhbarr.
dhbarr
Posts: 7
Joined: Tue Dec 18, 2007 10:50 am
Location: OKC, OK, USA
Contact:

Reproduced under Apache2Triad 1.5.4 , TimeTrex 2.1.3

Post by dhbarr »

Just for grins, I wiped out the previous install of TimeTrex -- have reproduced the exact same problem with Dynamic Interval Recurring Holidays under
  • TimeTrex_Standard_Edition_v2.1.3.zip , running on
  • apache2triad1.5.4.exe , executed on
  • Windows 2003 Server R2 Standard 32bit
For grins, tomorrow I'm going to try an older version of TimeTrex -- if it works, I'll post back and let you know if I can find the difference in timetrex\classes\modules\holiday\RecurringHolidayFactory.class.php

Code: Select all

			} elseif ( $this->getType() == 20 ) { //Dynamic - Week Interval
				Debug::text('Dynamic - Week Interval... Current Month: '. TTDate::getMonth( $epoch ) .' Holiday Month: '. $this->getMonth(), __FILE__, __LINE__, __METHOD__, 10);
				//Dynamic

				$start_month_epoch = $epoch;
				$end_month_epoch = mktime(12,0,0, $this->getMonth()+1, 1, (date('Y', $epoch)+1));

				Debug::text('Start Epoch: '. TTDate::getDate('DATE+TIME', $start_month_epoch) .' End Epoch: '. TTDate::getDate('DATE+TIME', $end_month_epoch), __FILE__, __LINE__, __METHOD__, 10);
				//Get all day of weeks in the month. Determine which is less or greater then day.
				$day_of_week_dates = array();
				for ($i = $start_month_epoch; $i < $end_month_epoch; $i+=86400) {
					if ( TTDate::getMonth( $i ) != $this->getMonth() ) {
						unset($day_of_week_dates);
						continue;
					}

					$day_of_week = TTDate::getDayOfWeek( $i );
					//Debug::text('I: '. $i .' Current Day Of Week: '. $day_of_week .' Looking for Day Of Week: '. $this->getDayOfWeek(), __FILE__, __LINE__, __METHOD__, 10);

					if ( $day_of_week == abs( $this->getDayOfWeek() ) ) {
						$day_of_week_dates[] = date('j', $i);
						Debug::text('I: '. $i .' Day Of Month: '. date('j',$i), __FILE__, __LINE__, __METHOD__, 10);
					}
				}

				$holiday_epoch = mktime(12,0,0, $this->getMonth(), $day_of_week_dates[$this->getWeekInterval()-1], date('Y', $i));
-dhbarr.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

This is fixed in v2.2.0, though I'm not 100% sure if its in -rc2, but it will be in the final release which is coming soon. (a few days)

In the mean time you can manually adjust the holiday dates in your holiday policies (Admin -> Policies -> Holidays -> Click Holidays beside each policy). You only need to adjust holidays that are already in that list and incorrect.
dhbarr
Posts: 7
Joined: Tue Dec 18, 2007 10:50 am
Location: OKC, OK, USA
Contact:

Post by dhbarr »

shaunw wrote:This is fixed in v2.2.0, though I'm not 100% sure if its in -rc2, but it will be in the final release which is coming soon. (a few days)
I think for now I'll stick with 2.1.2, which I have verified does not have this problem. When 2.2.0 is released, I'll give that a go as well. Thanks for the attention -- I feel like I -really- know this product now :)

-dhbarr.
Post Reply