From 265dd91a2d6335be32c5b9530c0716e63747d530 Mon Sep 17 00:00:00 2001 From: bvisness Date: Tue, 10 May 2022 00:03:58 +0000 Subject: [PATCH] Add 'ideas/time.md' --- ideas/time.md | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 ideas/time.md diff --git a/ideas/time.md b/ideas/time.md new file mode 100644 index 0000000..e45bb43 --- /dev/null +++ b/ideas/time.md @@ -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. \ No newline at end of file