A Waste of Time

Every now and then, you’ll come across some code that’s just like a car crash. The twisted, mangled-up kind of crash where the car’s on its side – possibly even on fire – and you can’t help but stare at the wreck with a mix of disgust and interest. Can it be fixed? Hmm, maybe something can be salvaged from the mess. Sheesh, I hope no one died as a result of this.

Samara N recently came across some car crash code: there were virtually no comments and the documentation simply read “handles time.” It came as no surprise that the code was written by Jared, also known as the Lead Developer’s sister’s daughter’s boyfriend. As everyone knows, nepotism rarely generates anything good, and in this case it generated something god-awful that no one dared to touch.

Jared’s time library was built around the traditional time.h library and used only time(NULL) calculations. Everyone on the team knew that Jared’s time system was a bit broken, but they still used it since parts of it actually worked. That is, until February 29 of last year, when the system came cashing to a halt. That’s when Samara went in to try to fix things.

The first line of time_help.h that greeted Samara seemed innocent enough.

Fortunately, by the time the February 29 bug was discovered, reported, and assigned, the day had almost passed, leaving Samara to mark the bug report as “fix later.” And hopefully, by the time the next February 29 rolls around, someone else will be there to fix it.

[Advertisement]
BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!