Return TypeFunction nameArguments
uint32_tIsHoliday(hzSDate&,uint32_t,)

Declared in file: hzCron.h
Defined in file : hzCron.cpp

Function Logic:

0:START 1:unknown 2:holFlags 3:unknown 4:items items items 5:unknown 6:test 7:unknown 8:test 9:items items items items 10:unknown 11:unknown 12:items test items test items test items items 13:unknown 14:test 15:unknown 16:test 17:items items 18:unknown 19:items items 20:unknown 21:items items items 22:unknown 23:test 24:unknown 25:test 26:items items items 27:unknown 28:test 29:unknown 30:test 31:items 32:Lo 33:unknown 34:Return false 35:Hi 36:unknown 37:theday 38:Return theday

Function body:

uint32_t IsHoliday (hzSDate& date)uint32_t holFlags, 
{
   //  Arguments: 1) date  Short form date
   //     2) holFlags By default, this will select UK public holidays
   //  
   //  Returns: >0 A bitwise value indicating which holiday the given date is
   //     0 If the given date is not a holiday
   _hzfunc(__func__) ;
   static  hzMapM<hzSDate,uint32_t>    hols ;      //  Known public holidays
   static  hzSet<uint32_t>             hol_year ;  //  Holidays calculated for year
   hzXDate     moon ;          //  Date & time of full moon
   hzXDate     limt ;          //  Run-up to full moon date
   hzSDate     test ;          //  Date to test if moon date is Good Friday/Easter Sunday
   uint32_t    Lo ;            //  First possible holiday date
   uint32_t    Hi ;            //  Last possible holiday date
   uint32_t    theday = 0; //  Holiday found
   uint32_t    nIndex ;        //  Holiday iterator
   if (!holFlags)
       holFlags = HZ_PUBHOL_ALLUK ;
   if (!hol_year.Exists(date.Year()))
   {
       //  If we have not yet calculated the holidays for the supplied year, do so now.
       hol_year.Insert(date.Year()) ;
       //  New year
       test.SetDate(date.Year(), 1,1);
       hols.Insert(test, HZ_PUBHOL_NEWYEAR) ;
       if (test.Dow() == 5)
           test += 2;
       if (test.Dow() == 6)
           test += 1;
       hols.Insert(test, HZ_PUBHOL_LUE_NEWYEAR) ;
       //  Calc Easter. Sunday after full moon after spring Equinox (March 21st)
       moon.SetDateTime("20120109083006") ;
       limt.SetDate(date.Year(), 3,21);
       limt.SetTime(0,0,0);
       for (; moon <&eq; limt ; moon.altdate(SECOND, 2541298));
       for (; moon.Dow() != 6; moon.altdate(DAY, 1));
       test.SetDate(date.Year(), moon.Month(), moon.Day()) ;
       test -= 2; hols.Insert(test, HZ_PUBHOL_GOOD_FRIDAY) ;
       test += 2; hols.Insert(test, HZ_PUBHOL_EASTER_SUNDAY) ;
       test += 1; hols.Insert(test, HZ_PUBHOL_EASTER_MONDAY) ;
       //  Mayday, First Monday in May
       test.SetDate(date.Year(), 5,1);
       if (test.Dow() == 5)
           test += 2;
       if (test.Dow() == 6)
           test += 1;
       hols.Insert(test, HZ_PUBHOL_MAYDAY) ;
       //  Last Monday in May
       test.SetDate(date.Year(), 5,31);
       for (; test.Dow() ; test -= 1);
       hols.Insert(test, HZ_PUBHOL_SPRING) ;
       //  Last Monday in August
       test.SetDate(date.Year(), 5,31);
       for (; test.Dow() ; test -= 1);
       hols.Insert(test, HZ_PUBHOL_SUMMER) ;
       //  Always Dec 25th
       test.SetDate(date.Year(), 12,25);
       hols.Insert(test, HZ_PUBHOL_XMAS) ;
       if (test.Dow() == 5)
           test += 2;
       if (test.Dow() == 6)
           test += 1;
       hols.Insert(test, HZ_PUBHOL_LUE_XMAS) ;
       //  Boxing day, always Dec 25th
       test.SetDate(date.Year(), 12,26);
       hols.Insert(test, HZ_PUBHOL_BOXING) ;
       if (test.Dow() == 5)
           test += 2;
       if (test.Dow() == 6)
           test += 1;
       hols.Insert(test, HZ_PUBHOL_LUE_BOXING) ;
   }
   Lo = hols.First(date) ;
   if (Lo < 0)
       return false ;
   Hi = hols.Last(date) ;
   for (nIndex = Lo ; nIndex <&eq; Hi ; nIndex++)
       theday |= hols.GetObj(nIndex) ;
   return theday ;
}