Being a programmer and obsessive about data is not always an ideal combination.
Most people make a habit of knowing their age. After all, it’s a basic vital statistic, and a useful piece of information to have on hand.
Of course, no one actually pays attention how old they are. After all, when you tell us you’re so-many years old, that’s only a vague approximation, with a typical variance of hundreds of days.
That is, unless you’re data-obsessed, and have the engineering skills to write a program to calculate your age to a higher degree of precision.
That’s where this story comes back to me. Over the years, I’ve written programs in several languages that tell me exactly how old I am. But since dates are messy, I don’t go too crazy about precision; two decimal places-a hundredth of a year is a three-day window-is close enough for me.
One of the oldest such programs runs as part of a
Rexx macro when I open up
Kedit, a favorite old text editor (and coincidentally the one I author my blogposts in). It calculates the difference between the current date and my date of birth, which is hardcoded in the program in Rexx’s standard “USA” format: MM/DD/YY.
All that worked great until a little while ago, when it started barfing up crap data. I didn’t pay much attention to the error until recently, when I was cleaning out a bunch of old code. And when I figured out what the problem was… it really pissed me off!
The relevant section of the manual spells it out rather bluntly:
When DATECONV() is used to convert a date that is specified using a 2-digit year, it assumes that the date falls within a 100 year sliding window starting at (current year - 50) and ending at (current year + 49).
For example, in 2007, DATECONV would convert 2-digit years to 4-digit years in the range 1957-2056. But in 2008, the sliding window would move by a year to cover 1958-2057.
Fast-forward to 2014, when Rexx decided that the “63” of my birth year no longer referred to 1963, but to 2063. In other words, shortly after I turned fifty, my birthday no longer fell within Rexx’s 50-year sliding window for converting two-digit years. It surprised me to realize that today we are actually closer to 2063 than we are to 1963!
So thanks Kedit/Rexx for breaking my age calculations. And thank you even more for letting me know that I’m too damned old for you to consider my birth year the most likely expansion of the two-digit abbreviation “63”.