[Chugalug] Calculating the next Thanksgivukkah

Robert A. Kelly III bluethegrappler at gmail.com
Wed Oct 9 01:39:34 UTC 2013


On 10/08/2013 08:41 PM, Wil Wade wrote:
> 79811 according to http://message.snopes.com/showthread.php?t=84036
> (Depending on how you count day vs night). Although calculating it
> yourself is so much more fun.
> 
> 
>     I get a date overflow error before I find another Thanksgivukkah.
> 
> Are you running it on a 64bit computer? Shouldn't have an issue getting
> to 79811 in Unixtime with 64bits.

I found the problem in the HebToJul() function in hbcal.c:

int HebToJul(int hy, int hm, int hd)
{
    int ylen;
    char const *monlens;
    int rh;
    int m;

    /* Do some range checking */
    if (hy - 3761 < BASE || hy - 3760 > BASE+YR_RANGE) return -1;

    ylen = DaysInHebYear(hy);
    monlens = DaysInHebMonths(ylen);

    /* Get the Rosh Hashana of the year */
    rh = RoshHashana(hy);

    /* Bump up to the appropriate month */
    for (m=0; m<hm; m++) rh += monlens[m];

    /* Add in appropriate number of days */
    rh += hd - 1;
    return rh;
}

When this function returns <0, GetNextHebrewDate() returns E_DATE_OVER.
Quick and dirty fix, commenting out the range checking line allowed me
to determine that the next date of Thanksgivukkah is indeed November 23,
79043!



More information about the Chugalug mailing list