Add 'ideas/time.md'

This commit is contained in:
bvisness 2022-05-10 00:03:58 +00:00
parent 88a4a5d385
commit 265dd91a2d
1 changed files with 64 additions and 0 deletions

64
ideas/time.md Normal file
View File

@ -0,0 +1,64 @@
- Timezones
- They are not always on the hour
- Difference time offset and timezone
- (locale stuff, formatting, DST transition dates, etc.)
- Daylight savings
- Days can be 23 or 25 hours long
- Countries change their DST rules all the time
- Dates, times, datetimes
- Maybe you don't actually want to store full timestamps for literally everything
- Time math is tricky
- Adding 24 hours != adding one day (leap days / seconds)
- Calendars
- Historical calendars are very weird (kings just removing or adding days when they felt like it)
- The calendar we use, and its extensions: Gregorian calendar, proleptic Gregorian calendar
- Other calendars: Jewish calendar, Chinese lunar calendar (?), Hijiri
- Primarily used for establishing holidays, but not really for common use any more (with the exception of China...?)
- Computer clocks
- CPU time vs. wall time
- Monotonic clocks
- Two kinds on Linux: one that smears forward, one that does not
- Jiffies
- Atomic clocks
- NTP / chrony
- Useful specs:
- RFC3339: https://datatracker.ietf.org/doc/html/rfc3339
- iCal: https://icalendar.org/RFC-Specifications/iCalendar-RFC-5545/
- Recurrence rules (RRULE): https://icalendar.org/iCalendar-RFC-5545/3-8-5-3-recurrence-rule.html
- NOBODY USES ISO8601 STOP SAYING THAT THEY DO
- NO ONE KNOWS WHAT IT IS
- RFC3339 IS THE ONLY ONE ANYONE SHOULD USE
- Accuracy of onboard clocks
- Quartz oscillators - subject to drift
- How to correct inaccurate clocks
- Time smearing
- Presentation and formatting?
- The UNIX epoch, and the year 2038 problem
- ISO "week date" (does this matter to anyone)
- Falsehoods I think are actually important
- "Always store time in UTC"
- "Always store fully-qualified timestamps" i.e. datetimes with timezone, not just dates
- "The smallest unit of time is X" (i.e. store the start and end of your time ranges precisely, never store 11:59:59)
You get a time you trust - then you work with it in some way (???)
https://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time
https://engineering.fb.com/2021/08/11/open-source/time-appliance/
https://github.com/opencomputeproject/Time-Appliance-Project/tree/master/Open-Time-Server/
https://lettier.github.io/posts/2016-04-26-lets-make-a-ntp-client-in-c.html
https://audiogramii.wordpress.com/2018/03/31/time-smearing/
https://docs.ntpsec.org/latest/leapsmear.html
https://aws.amazon.com/blogs/aws/look-before-you-leap-the-coming-leap-second-and-aws/
https://sudonull.com/post/29903-Writing-a-Simple-NTP-Client
https://www.oreilly.com/library/view/linux-device-drivers/9781785280009/4041820a-bbe4-4502-8ef9-d1913e133332.xhtml
https://www.youtube.com/watch?v=-5wpm-gesOY
Official timezone database: https://www.iana.org/time-zones
## How to use dates and times
## Time accuracy / how to get accurate times
## Fun tangents
East Asian countries treat birthdays differently: https://en.wikipedia.org/wiki/East_Asian_age_reckoning. In particular, Koreans (and others??) all celebrate their birthday on January 1, and start counting at 1 instead of 0.