I was going through the changelog to see what bugs have been fixed since my version of Circlemud (bpl14) and came across this entry... -- gg - act.informative.c: do_time(): Simplified by suggestion from Andrew Jones <andjones@mci2000.com> So I pulled up do_time in bpl14 and compared it to that in bpl15 and 17 (note: I did not look at 16). I found the following change... bpl14: if (day == 1) suf = "st"; else if (day == 2) suf = "nd"; else if (day == 3) suf = "rd"; else if (day < 20) suf = "th"; else if ((day % 10) == 1) suf = "st"; else if ((day % 10) == 2) suf = "nd"; else if ((day % 10) == 3) suf = "rd"; else suf = "th"; bpl15 & 17: if ((day % 10) == 1) suf = "st"; else if ((day % 10) == 2) suf = "nd"; else if ((day % 10) == 3) suf = "rd"; else suf = "th"; Nice simplification, unfortunately it broke the function. The code in the newer versions will return the following incorrect suffixes... 11st 12nd 13rd I would suggest the following simplification be used instead... suf = "th"; if (day/10 != 1) { switch (day % 10) { case 1: suf = "st"; break; case 2: suf = "nd"; break; case 3: suf = "rd"; break; } } The first if statement will make sure that the suffix is not changed for 11, 12, or 13. Regards, Peter -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/03/01 PST