5-Digit Year Problem

I am a member of the Long Now Foundation and the Long Now Foundation uses 5-digit years (e.g. 2010 is 02010). 2010, unlike 2009, is a valid octal (base-8) number.

Many of the C-family programming languages have a 5-digit year problem.

Numbers that start with a zero are treated as octal numbers by the compiler. 02009 is not a valid octal number because nine is not a valid octal digit. 02010 is comprised of four valid octal digits.


/* int lastyear = 02009; // doesn't compile */
int thisyear = 02010; // compiles
cout << thisyear; // prints 1032

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: