I am trying to figure out what I am doing wrong. I have had friends look at this and we can't figure out why the program doesn't enter the IF statement. WE believe the hour ==12 and offset < zero is satisfied.
I am guessing we are missing something stupid.
CODE:
// when do I need to switch AM / PM??
// when after the offset, the time is negative or greater than 12
// if old hour is 12, and the offset is negative
// if the old hour is 11 and the offset is positive
// switch AM and PM
Sys.println("Switch A and P? " + switchAP + "; hour: " + dTime["hour"] + "; Total Offset: " + totalOffset.toNumber().format("%d"));
if((12 == dTime["hour"] && 0 > totalOffset) || switchAP || (11 == dTime["hour"] && 0 < totalOffset) )
{
Sys.println("Switch");
dTime["AP"] = switchDayandNight(dTime["AP"]);
}
Console OUTPUT:
Start of Apply Offset
Split Time - dTime:{min=>04, sec=>12, hour=>12, AP=>A}
New Time: 6; 4; 12
Switch A and P? false; hour: 12; Total Offset: -21600 ******* after this statement I believe it should type "Switch"
End of calculate Offset: 6:04:12 AM