User talk:Dmclapp
Hello, I noticed you added 'calendar' to the AWK language. I have copied the code to my machine (running Windows 8 and gawk 4.1) and have noticed that it doesn't work for leap years. For example, - year 2013 is OK - year 2012 is NG: missing 2/29, March starts on Wed and S/B Thurs, March has 29 days, etc. - years 2011-2009 are OK - year 2008 is NG tested via: ECHO 2012 | GAWK -f CALENDAR.AWK -
Thanks for testing. When did you copy the code? I think at some point I noticed a problem like that and fixed it. That would have been on 22 Sep 2013 when I uploaded code for lastsunday. Check to see if you have a line "# leap year adjustment" followed by "leap = 0" and 3 lines starting "if" and ending with "leap = 0" or "leap = 1" --Dmclapp (talk) 00:33, 15 October 2013 (UTC)
I downloaded the code on 2013-10-08. Yes, I have all of those lines. The solution is to change, within the "process for every record" action old: if (leap == 1 && i == 2) monsize = 29 new: if (leap == 1 && i == 1) monsize = 29 Because, at the top of the for loop you do January; at the bottom you test (leap=1 and i==2) which is false at this point; back to the top does February but only with 28 days; at bottom you test again (leap=1 and i==2) which is true so the monsize is set to 29; back to the top does March with 29 days only. User:Catskill549 09:15, 15 October 2013
Apparently I missed one change when I edited in the corrections. I changed "if (leap == 1 && i == 2) monsize = 29" to "if (leap == 1 && monsize == 28) monsize = 29" Try that. Sorry about the confusion. --Dmclapp (talk) 19:03, 15 October 2013 (UTC)