 Dealing with dates and time and computer applications can be one of the most difficult programming problems that a developer will ever encounter if they try to implement the solution themselves. Because dates and time are actually a lot more complicated and a lot more arbitrary than you might realize. For example, if you needed to display the current time in your app right now for people in different regions of the world, you've got to account for a lot more than just the 24 time zones for the 24 hours in a day. And different countries change their time zone at different times and in different directions, depending on what hemisphere they're in. And in places like the West Bank, you can have different people that are essentially living in the same geographic region, but they are still following different time zones. Then of course, there's leap years, which isn't as simple as just adding an extra day to February every four years because every century, you have to skip a leap year. Otherwise, we would be getting a day ahead every century. Unless the century is divisible by four, then you add a leap year to then prevent us from falling behind every 400 years. And don't get me started on how relativity can affect the internal clock of satellites and other systems that are going really, really fast or that are orbiting something really, really massive. Now luckily, if you're programming a system that ever has to deal with the current time or daylight savings or whatever, you can use code libraries that were written by someone else who already accounted for all of these things. And it's kept up to date. The code library is at least hopefully kept up to date. So you can just call on that library from your code base and then save yourself the trouble and the sleepless nights of having to solve for time yourself. Unfortunately for motorists and other people who needed fuel in New Zealand, the payment terminals that were used by fuel pumps at petrol stations appeared to have tried to solve the time problem on their own, the developers of them tried to solve it on their own, and they made a mistake. The payment processor had a leap year bug, so it wasn't able to process the date, February the 29th, and ultimately the terminals were not able to process payments for about 10 hours of yesterday. Well, engineers fixed the problem and then eventually rolled out the patches to those terminals. And there were other less severe leap year bugs that didn't get as much news coverage yesterday. A couple of smartwatches like the FastTrack FS1 and the Amazfit had problems displaying the correct date and time throughout the day, which I guess if you consider the fact that this is a bug in a watch preventing it from displaying the time and day, it's actually an even more critical bug because at least the people in New Zealand that wanted to get some gas were still able to do so with cash or with other methods that didn't use the payment terminals. The open source RPG game Lilith's Throne had a bug that caused the game to crash because for some reason it was internally changing the date from February the 29th, 2024 to February the 29th, 2019, and then that throws a Java dot time dot date time exception invalid date error because 2019 didn't actually have a leap year. The you need a budget aka YNAB budgeting app had trouble tracking recurring scheduled transactions that were supposed to take place at the end of the month so that was another leap day issue and also in Sweden a grocery store chain had the exact same kind of problem as New Zealand's fuel pumps did where a leap day glitch prevented people from being able to pay at the terminals with their bank cards. Now because New Zealand is so close to the international date line it's technically one of the first countries to actually start any new day and this had some people worried that the issue with the payment terminals would start sweeping across the rest of the world outside of New Zealand similarly to how people thought the Y2K glitch would have started rolling out across the world as the new year happened for each country but luckily and strangely only in Venco payment terminals that were localized to New Zealand were affected so I don't know I guess they were running different code under the hood in New Zealand then in the rest of the world for some reason and in-house payment options such as BP fuel cards and the Waitomo app reportedly still worked during the outage and of course like I said earlier you could have still paid cash that's yet another reason to never give up on good ol paper money because you never know when something as silly as a leap year glitch is going to prevent you from being able to use your credit card now there's still some mysteries as to why this glitch just now happened because yeah we know that it was caused because of the leap day you know February 29th doesn't happen each year but those do happen every four years and we're probably I don't know 16 or more years at this point into people using credit cards as the primary payment method at gas stations for getting fuel it's so common here in the US that a lot of credit card companies actually give you a percentage of cash back when you use them to pay for gas and I'm pretty sure that paying for fuel and all that stuff is handled in New Zealand in a very similar way the only difference that I really found between fueling up in New Zealand versus the states is that over there you actually fill up before you pay but I doubt that that would have anything to do with actually using your credit card so at this time it's unknown why this glitch didn't occur four years ago and I guess it's also somewhat unknown if the glitch is going to occur four years in the future but what is certain is that you really should try at all costs to avoid this issue in the first place by avoiding programming dates and times yourself whether you're writing software for a Swedish grocery store or a Kiwi gas station it's really easy to make false assumptions about how dates and time work and you end up with some critical bugs like the ones that you heard about today in the days of computing before the internet these kinds of problems were to be expected because people didn't really use software libraries that often back then they just did everything themselves but like I said most of the time you can find a software library that's already been written in the same language you're using for whatever project you're going to be doing that you can drop in to handle these things correctly rolling your own calendar library is not a good idea because you probably don't understand time as well as you think you do if you enjoyed this video please like and share it to hack the algorithm and check out my online store base.win where you can buy awesome merch like the little daemon t-shirt or the come and find it hoodie and on base.win you can automatically save 10% off your entire order at checkout when paying in the secure and private cryptocurrency Monero XMR have a great rest of your day