 Hallo und herzlich willkommen zurück auf dem Flugkanal und zwar zu unserem ersten Livetalk. Unser nächster Speaker ist Sartan, er studiert Medientechnologie an der TU Ilmenau und arbeitet außerdem im Bereich Machine Learning. In seiner Freizeit beschäftigt er sich mit Assemblieskript und ist dabei auf die Zeitzonen-Latenbank der IANA gestoßen. Und was er dort gefunden hat, das erzählt er uns jetzt. Vor Englisch-Speaking-Viewers, there is a translation to listen to it in the web player select language selection and then translate it. Und jetzt bühne frei für Sartan. Dankeschön. Hallo. Back at the University of Ilmenau, it's our first live talk. Our speaker is called Satan, he studied at the University in Ilmenau and in his spare time he is interested in JavaScript and other things. This is a translation by Castel, maybe Celeste. We look forward to your feedback on hash C3 lingo and enjoy the talk. Welcome to my talk. My talk is about the time zone database and why you definitely shouldn't be implementing them to yourself. So, first of all, this is what I want to talk about. In the beginning I want to do the general information on the IANA time zone database and the main things that I will show you, examples and usage in order to show you what you can do a bit. So, in general, the IANA time zone database is published. IANA is the Internet Assigned Numbers Authority. It usually concerns itself in S. Time zones, IP addresses. The time zone database is also called TZ, TZDB or zone info. And the idea behind it is that you have a totally complete list of zones, times zone offsets for all countries in the world. And not just countries, but also areas. It's not necessarily countries. You just go from the stream. And it's used to calculate and don't differentiate. It's kept current all the times. So, if there's a law that changes something or new countries show up or some other reasons make it obsolete, then it's being updated. And it's going to be pushed out to all the systems that are based on it so that all over the world the systems kept up to date. So, you could actually be under the impression that it's a very current phenomenon, but it actually contains all the time zones for the older history, even before 1970, where UTC before UNIX. So, that's the dates 1972 and 1970. As in a general site, it's publicly available. You can just go onto a website and grab it. It's a folder with all the files. You can also get TAR files. There's also a Git repository, where you can get it from. There's an FTP server, even ArtSync. It's pretty flexible. So, the effort that you have to spend to get it is really low. It's mostly just text files or all of it is text files. They are organized by the continent. So, there's one for Europe, one for America, one for Africa. It's a CSV-similar format. It's not separated by the comments here, but by characters. It's a tab. And there are also comments in the file that explain why something was changed, what changed, links to the legislative body that changed it, for example, like laws. There are also a few scripts that you can use to take these human-readable formats und export it into something that the machine can use much better in order to be able to use it in libraries so you don't have to parse the text all the time. One of the basic rules is, you have zones. They're usually named after a continent or an ocean. Then you have a slash and then a major city. My excerpt that I'm showing here, this is Euro-Berlin. This is the name of the zone. So, these files contain a list of rules that changes. That means it shows you when there is a change, what you have to use before and after. It also gives you the base offset. It's the basic offset that all of the areas within that zone all have in common. And then there's a format column. It's basically the name for the column. So, here you can see the percent S. I'm gonna talk about that later. The second thing are the rules. There's a complete set of rules. Every line is a rule when the offset changes. What it also contains is, if you look at the last column, it says a letter. That column is a letter that being inserted into the name when it's being applied. One interesting thing about it is, there are two different sets of rules for changing from electricity time to normal time. It means that the move from day-like saving time to winter time can happen more often than the other way around. And I want to now explain the syntax to you. So, I'm not gonna show you the code anymore, but I have a better format at the table. So, it's easier to understand. So, the first thing that we want to look at is Zion. It's the first interesting area I found. I brought my own parser that took this human readable format and the first thing I did was I just set it out one rule at a time and this one failed here because it's only happened once. Because it has this, if you look at the Friday column, the on column, it basically tells you it ruled when this offset, that is specified in the save column is being applied. It says, try smaller equal than one. If the first Friday in April falls onto the second or the sixth, then we take the Friday from the month earlier. That's one of those things that's already very hard to implement. So, if you want to use it later, so if you write your own library. And this is the second example. This is Lord Howey. This is an island in Australia. There is a rule. They have a data saving time of 30 minutes. That means they always switch between an offset of 0 minutes and 30 minutes. And it's a similar syntax to the one that we just looked at, but we're greater or equal. So, that means it's always the first Sunday in a month, but it has to be the first. So, it can't be the month earlier. So, then there are other interesting things that I looked at. This is war and peace time. This is in the US rule set. They have two rules. Two changes of the offsets. It was in 1942 and 1945. So, they changed the letter from S to W and P for war and peace. And this changes the time zone name. I'm going to talk about it later, what that looks like in the name. So, you see here in the two column, it says only. That means it only happens in just that one year. And what I can also see. The add column. There is a small U that is suffix. You can have suffixes here. You can have, for example, S. That means the base offset is taken from the zone. It's also G. That means that the time is being specified in Greenwich Mean Time. And here you can see U, that means it's UTC. Or if there's nothing there, if there's W, that's the standard, then it means it's the war clock or local time. So. This is the default. This is usually omitted, like you see here in all the others. So, this is what Daylight Saving Time works. Like, you have separate lines for winter and summer time or Daylight Saving Time and normal time. So, here you can see that the rules for the Daylight Saving Time for the winter time have changed more often than the summer time at Daylight Saving Time. And there's max in the two columns here. That means this always means that it's still current and that this is what's currently being applied. So, here you can see Hawaii. That means it's a zone. You can see in the first two columns that the entries aren't being repeated because they always are referring to the same zone and that's why you can omit it. And what you can see here is in the format there's LMT, that is the abbreviation for the time zone. LMT means local mean time and it's actually not a real time zone but it's being used in the database if there's not a proper name for it because nothing had been published. So, you can already see this has been valid up until 1896. So, this is long before we did too much thinking about time zone. What you can also see here is the format again with the percent S in the fourth row. This is where the letter that's being specified in the last column and the other rules that we looked at, this is what is being replaced here. So, there's also a rule set that has to be applied here. If there's a minus or a single number, then this is nothing that would be replaced here. You have to specify an actual letter for that. And it shows you which is being applied. So, the rule set that you should use if there's a time, this is just the offset. If there's a name, like US, then this is the name of a rule set that you have to apply for this. Okay, I also want to show you Alaska. Alaska was sold by Russia to the US in 1867. And that means they changed their offset from a positive 11 hours to 6 hours negative. So, because it switched the other side of the dateline. And that means that a certain day occurred twice. So, in 1867, die Oktober 19, basically was set back by 20-something, then the day happened again on the other side of the dateline. So, I want to show how this all works together. You can see the zone, you're Berlin, the one that is used in Germany. You can see the second to last entry was valid until 1980 and we're past that. So that if the until fuel is empty, that means it's still valid. And we have a standard offset of one hour. And then there's a rule set that's called EU. And the format placeholder is CE percent as T. So, that's a placeholder. We look at the current rule set that's currently valid. It's the one valid from 1996. That's the rule set for changing from wintertime to daylight saving time. And between in Oktober we applied the lower rule to set an offset to zero. And that means we're at zero offset of zero. And we look at the letter that has a dash. That means we don't have one. And that means we have the form at CE. And if it would be in the summertime, it would be in the upper rule and we had a letter S. And it would be C, ST and another offset of an hour. Okay, thank you for your attention. That's all from me. I wish you a lot of fun at the congress. If you still have questions write to me on master. I'm going to send you some the link to the timezone database. This has been our translation done by Caste for the talk why you shouldn't implement timezones yourself. We sign out here. We wish you fun at the congress. Please give us feedback at the hashtag and it's still a breakout session that's being linked to here. If you want to join that, have fun. Bye bye.