Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Gregorian calendar leap year

Name: Anonymous 2012-05-07 14:51

I have to make a POSIX-friendly program in C that receiving a String it would test if the String is a valid gregorian calendar year and if it is a leap year.

My question is this: should I only consider years above 1582?

Name: Anonymous 2012-05-07 15:12

What context are you writing this program (or function) in? If it's built for recent dates, you might as well only consider years above 1900 or so; if you really need to support historical dates, you might start looking at some different calendar systems.

Also, a fun fact from the cal manpage (in fact, taking a look at cal's source code might be interesting):

The Gregorian Reformation is assumed to have occurred in 1752 on the 3rd of September. By this time, most countries had recognized the reformation (although a few did not recognize it until the early 1900's.) Ten days following that date were eliminated by the reformation, so the calendar for that month is a bit unusual.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List