Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Is your code ready for the leap year?

03 Feb 2016   #1
Brink

64-bit Windows 10 Pro
 
 
Is your code ready for the leap year?

Quote:
As we enter February, it's a good time to remember that 2016 is a leap year. For most people, this may just be an interesting oddity; an extra day to work or play. But for software developers, the leap year can cause significant pain.

If you are just now thinking about checking your code for leap year bugs, you better move quickly. In fact, you might already be experiencing the effects and may not even realize it! What kind of bugs might be lurking in your code?
  • Off-by-one issues, especially around data filtering using date-range queries
  • Unexpected or undesired behavior in user interfaces
  • Potential for exceptions, crashes, or hanging as edge cases are encountered
“Meh,” you say. “My code is just fine. We have unit tests.”

“Oh really,” I say. “Do your tests properly mock the clock? Do they test edge cases including February 29 and December 31? Have you tested any low-level C++ code you might have as well as the rest of your system? Do you even know what a leap year bug looks like?”

Most often, blank stares.

Why does this matter for Azure?

Well really, it applies to just about any code a developer might write, and quite a lot of it may end up running in the Azure cloud! Azure had a leap year outage of its own in 2012, and we've been working hard to ensure a smooth experience this time around. We'd like all of our customers to benefit from our research and experiences since then.

Ok, so what do I need to know?

There's a lot to cover here, so let's start with the most important things first.
  • February 29 is not the only day affected by the leap year. Another very important date is December 31, because it is the 366th day of the year and many applications mistakenly hard-code a year as 365 days.
    • With particular consideration for the cloud, also consider the vast majority of cloud applications use UTC (Coordinated Universal Time), or at least, they should. That means at midnight on February 29, it may actually be some other time in your local time zone. For example, in the US Pacific time zone, the leap day will hit UTC when it is 4:00 PM on February 28 (the previous day on the calendar). Check times in other time zones.
    • If you are preparing to monitor your system in real-time for leap day issues, you should be considering the three-day window from February 28 through March 1. Likewise, you should watch out for day 366 issues from December 30 through January 1.
  • Leap year bugs can be found anywhere, in any language, but are most dangerous in C / C++ code, where they can cause application crashes or buffer overflows (which are a security risk).
  • Past leap years have included some high-impact, high-profile bugs, such as:
These are just the big stories that made news headlines. I'm sure thousands more occurred with varying degrees of impact and noticeability. Another lesser-known leap year bug from 1996 actually caused process control systems at aluminum smelting plants in New Zealand and Tasmania to shut down abruptly at the stroke of midnight on December 31 (the 366th day).

This resulted in millions of dollars in damage to equipment as temperatures of molten metal went unregulated. Stories from yesteryear like this one remind me of the real-world dangers of software glitches. Considering the recent widespread adoption of IOT and its intersection with cloud computing, we should all be on high alert...


Read more: Is your code ready for the leap year? | Microsoft Azure Blog


My System SpecsSystem Spec
.
Reply

 Is your code ready for the leap year?




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
This year's Y2K: 'Leap second' threatens to break the Internet
More: This year's Y2K: 'Leap second' threatens to break the Internet - Jan. 13, 2015 Original IERS bulletin:
News
Should I take the leap?
Hello guys, sorry for the inactivty, business is booming :) Even though I've always said that I would never upgrade to Windows 8 I am thinking of it. Why? Well, to be honest - I don't know myself. I am wondering whether or not Win7 64bit programs run on Win8. I haven't really done the...
Windows Updates & Activation
ok im taking a big leap into overclocking --->
i really wanna over clock my board from 2.8ghz to 3.2 but im not to sure how to over clock all my spec info is on my system spec page and i can provide more info. can some one give me a crash course on the diff over clocking types ie ram cpu gpu ect . wait you can over clock ram right lol
PC Custom Builds and Overclocking
Just looking before I leap...new PC final thoughts.
I've ordered the monitor (NEC EA232WMi) which is scheduled to arrive today & think I have selected a good case, MB, RAM, power supply & CPU. I thought I'd ask those with more experience for their commits as I've never built a PC before. · Intel Core i5-2500K Sandy Bridge 3.3GHz · ...
Hardware & Devices
W7 Leap Authenication
Well I have been trying to get the wireless setup on the computer at work. We use Cisco LEAP to secure it, now I can get the system to see the network and try to connect but each time it kicks back asking for username and password. I put in the information and yet it still doesnt work. We...
Network & Sharing
Nine year old writes iPhone code
Here's something for you iPhone users. BBC NEWS | Technology | Nine-year-old writes iPhone code
Chillout Room


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 20:50.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App