Blame it on Ceasar: A rant on calendaring¶
by Lennart Regebro
Timekeeping on all levels is surprisingly difficult. This talk explains why it’s sort hard, and which parts Python can help you with.
- What is calendaring, really, and why is it so complex?
- What’s in a year?
- Dissecting the Julian/Gregorian calendar
- Mesopotamian mathematics
- Time zones
- Recurring events is less fun than you think.
The problem with calendaring is that it is based off of multiple cycles that don’t work well with each other
Rome: They had a 10 month calendar that made winter a dead period in the calendar. Eventually they added January and February
- The year is twelve lunar months long.
- The year is out of sync with the seasons
- Example: The Islamic Calendar
The year is 12 or 13 months long
The year is kept in sync with season by leap months
The villain of the story is Caesar
The year follows the solstices/seasons
The moon is ignored completely
- French republican
- Julian Calendar
Thanks to the success of the Roman Empire Europe takes a weird Solar calendar, and thanks to the success of Europe, the world takes it on too.
How do you implement the calendar yourself?¶
You don’t. You use libraries.
Python has datetime, date, and calendar
Java has issues thanks to an early design decision mistake.
The US calendar shows Sunday as the first day of the week, which is confusing because it puts the first day on the weekend.
- There are not 24 timezones, there are standard times per country
- standard times change
- If you want to accurate describe times from the past, you need a database of timezone changes.
- Australia CST
- China Standard Time
- Chungua Standard Time
- US CST
Timezones are based on politics, not science.
Daylight Savings Time¶
- Changing the hour can cause problems with computers. Going over midnight twice breaks things.
- Python handles it well
He gave examples of how this module does a lot of the lifting for you on timezones and daylight saving time:
pytz 30 - 15 dateutil
- Works well
- Except for POSIX
Current standard specification¶
- TODO: Find out specified RFCs