A place to cache linked articles (think custom and personal wayback machine)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 75KB

5 lat temu
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299
  1. <!doctype html><!-- This is a valid HTML5 document. -->
  2. <!-- Screen readers, SEO, extensions and so on. -->
  3. <html lang=fr>
  4. <!-- Has to be within the first 1024 bytes, hence before the <title>
  5. See: https://www.w3.org/TR/2012/CR-html5-20121217/document-metadata.html#charset -->
  6. <meta charset=utf-8>
  7. <!-- Why no `X-UA-Compatible` meta: https://stackoverflow.com/a/6771584 -->
  8. <!-- The viewport meta is quite crowded and we are responsible for that.
  9. See: https://codepen.io/tigt/post/meta-viewport-for-2015 -->
  10. <meta name=viewport content="width=device-width,minimum-scale=1,initial-scale=1,shrink-to-fit=no">
  11. <!-- Required to make a valid HTML5 document. -->
  12. <title>UTC is Enough for Everyone, Right? (archive) — David Larlet</title>
  13. <!-- Generated from https://realfavicongenerator.net/ such a mess. -->
  14. <link rel="apple-touch-icon" sizes="180x180" href="/static/david/icons/apple-touch-icon.png">
  15. <link rel="icon" type="image/png" sizes="32x32" href="/static/david/icons/favicon-32x32.png">
  16. <link rel="icon" type="image/png" sizes="16x16" href="/static/david/icons/favicon-16x16.png">
  17. <link rel="manifest" href="/manifest.json">
  18. <link rel="mask-icon" href="/static/david/icons/safari-pinned-tab.svg" color="#5bbad5">
  19. <link rel="shortcut icon" href="/static/david/icons/favicon.ico">
  20. <meta name="apple-mobile-web-app-title" content="David Larlet">
  21. <meta name="application-name" content="David Larlet">
  22. <meta name="msapplication-TileColor" content="#da532c">
  23. <meta name="msapplication-config" content="/static/david/icons/browserconfig.xml">
  24. <meta name="theme-color" content="#f0f0ea">
  25. <!-- That good ol' feed, subscribe :p. -->
  26. <link rel=alternate type="application/atom+xml" title=Feed href="/david/log/">
  27. <meta name="robots" content="noindex, nofollow">
  28. <meta content="origin-when-cross-origin" name="referrer">
  29. <!-- Canonical URL for SEO purposes -->
  30. <link rel="canonical" href="https://zachholman.com/talk/utc-is-enough-for-everyone-right">
  31. <style>
  32. /* http://meyerweb.com/eric/tools/css/reset/ */
  33. html, body, div, span,
  34. h1, h2, h3, h4, h5, h6, p, blockquote, pre,
  35. a, abbr, address, big, cite, code,
  36. del, dfn, em, img, ins,
  37. small, strike, strong, tt, var,
  38. dl, dt, dd, ol, ul, li,
  39. fieldset, form, label, legend,
  40. table, caption, tbody, tfoot, thead, tr, th, td,
  41. article, aside, canvas, details, embed,
  42. figure, figcaption, footer, header, hgroup,
  43. menu, nav, output, ruby, section, summary,
  44. time, mark, audio, video {
  45. margin: 0;
  46. padding: 0;
  47. border: 0;
  48. font-size: 100%;
  49. font: inherit;
  50. vertical-align: baseline;
  51. }
  52. /* HTML5 display-role reset for older browsers */
  53. article, aside, details, figcaption, figure,
  54. footer, header, hgroup, menu, nav, section { display: block; }
  55. body { line-height: 1; }
  56. blockquote, q { quotes: none; }
  57. blockquote:before, blockquote:after,
  58. q:before, q:after {
  59. content: '';
  60. content: none;
  61. }
  62. table {
  63. border-collapse: collapse;
  64. border-spacing: 0;
  65. }
  66. /* http://practicaltypography.com/equity.html */
  67. /* https://calendar.perfplanet.com/2016/no-font-face-bulletproof-syntax/ */
  68. /* https://www.filamentgroup.com/lab/js-web-fonts.html */
  69. @font-face {
  70. font-family: 'EquityTextB';
  71. src: url('/static/david/css/fonts/Equity-Text-B-Regular-webfont.woff2') format('woff2'),
  72. url('/static/david/css/fonts/Equity-Text-B-Regular-webfont.woff') format('woff');
  73. font-weight: 300;
  74. font-style: normal;
  75. font-display: swap;
  76. }
  77. @font-face {
  78. font-family: 'EquityTextB';
  79. src: url('/static/david/css/fonts/Equity-Text-B-Italic-webfont.woff2') format('woff2'),
  80. url('/static/david/css/fonts/Equity-Text-B-Italic-webfont.woff') format('woff');
  81. font-weight: 300;
  82. font-style: italic;
  83. font-display: swap;
  84. }
  85. @font-face {
  86. font-family: 'EquityTextB';
  87. src: url('/static/david/css/fonts/Equity-Text-B-Bold-webfont.woff2') format('woff2'),
  88. url('/static/david/css/fonts/Equity-Text-B-Bold-webfont.woff') format('woff');
  89. font-weight: 700;
  90. font-style: normal;
  91. font-display: swap;
  92. }
  93. @font-face {
  94. font-family: 'ConcourseT3';
  95. src: url('/static/david/css/fonts/concourse_t3_regular-webfont-20190806.woff2') format('woff2'),
  96. url('/static/david/css/fonts/concourse_t3_regular-webfont-20190806.woff') format('woff');
  97. font-weight: 300;
  98. font-style: normal;
  99. font-display: swap;
  100. }
  101. /* http://practice.typekit.com/lesson/caring-about-opentype-features/ */
  102. body {
  103. /* http://www.cssfontstack.com/ Palatino 99% Win 86% Mac */
  104. font-family: "EquityTextB", Palatino, serif;
  105. background-color: #f0f0ea;
  106. color: #07486c;
  107. font-kerning: normal;
  108. -moz-osx-font-smoothing: grayscale;
  109. -webkit-font-smoothing: subpixel-antialiased;
  110. text-rendering: optimizeLegibility;
  111. font-variant-ligatures: common-ligatures contextual;
  112. font-feature-settings: "kern", "liga", "clig", "calt";
  113. }
  114. pre, code, kbd, samp, var, tt {
  115. font-family: 'TriplicateT4c', monospace;
  116. }
  117. em {
  118. font-style: italic;
  119. color: #323a45;
  120. }
  121. strong {
  122. font-weight: bold;
  123. color: black;
  124. }
  125. nav {
  126. background-color: #323a45;
  127. color: #f0f0ea;
  128. display: flex;
  129. justify-content: space-around;
  130. padding: 1rem .5rem;
  131. }
  132. nav:last-child {
  133. border-bottom: 1vh solid #2d7474;
  134. }
  135. nav a {
  136. color: #f0f0ea;
  137. }
  138. nav abbr {
  139. border-bottom: 1px dotted white;
  140. }
  141. h1 {
  142. border-top: 1vh solid #2d7474;
  143. border-bottom: .2vh dotted #2d7474;
  144. background-color: #e3e1e1;
  145. color: #323a45;
  146. text-align: center;
  147. padding: 5rem 0 4rem 0;
  148. width: 100%;
  149. font-family: 'ConcourseT3';
  150. display: flex;
  151. flex-direction: column;
  152. }
  153. h1.single {
  154. padding-bottom: 10rem;
  155. }
  156. h1 span {
  157. position: absolute;
  158. top: 1vh;
  159. left: 20%;
  160. line-height: 0;
  161. }
  162. h1 span a {
  163. line-height: 1.7;
  164. padding: 1rem 1.2rem .6rem 1.2rem;
  165. border-radius: 0 0 6% 6%;
  166. background: #2d7474;
  167. font-size: 1.3rem;
  168. color: white;
  169. text-decoration: none;
  170. }
  171. h2 {
  172. margin: 4rem 0 1rem;
  173. border-top: .2vh solid #2d7474;
  174. padding-top: 1vh;
  175. }
  176. h3 {
  177. text-align: center;
  178. margin: 3rem 0 .75em;
  179. }
  180. hr {
  181. height: .4rem;
  182. width: .4rem;
  183. border-radius: .4rem;
  184. background: #07486c;
  185. margin: 2.5rem auto;
  186. }
  187. time {
  188. display: bloc;
  189. margin-left: 0 !important;
  190. }
  191. ul, ol {
  192. margin: 2rem;
  193. }
  194. ul {
  195. list-style-type: square;
  196. }
  197. a {
  198. text-decoration-skip-ink: auto;
  199. text-decoration-thickness: 0.05em;
  200. text-underline-offset: 0.09em;
  201. }
  202. article {
  203. max-width: 50rem;
  204. display: flex;
  205. flex-direction: column;
  206. margin: 2rem auto;
  207. }
  208. article.single {
  209. border-top: .2vh dotted #2d7474;
  210. margin: -6rem auto 1rem auto;
  211. background: #f0f0ea;
  212. padding: 2rem;
  213. }
  214. article p:last-child {
  215. margin-bottom: 1rem;
  216. }
  217. p {
  218. padding: 0 .5rem;
  219. margin-left: 3rem;
  220. }
  221. p + p,
  222. figure + p {
  223. margin-top: 2rem;
  224. }
  225. blockquote {
  226. background-color: #e3e1e1;
  227. border-left: .5vw solid #2d7474;
  228. display: flex;
  229. flex-direction: column;
  230. align-items: center;
  231. padding: 1rem;
  232. margin: 1.5rem;
  233. }
  234. blockquote cite {
  235. font-style: italic;
  236. }
  237. blockquote p {
  238. margin-left: 0;
  239. }
  240. figure {
  241. border-top: .2vh solid #2d7474;
  242. background-color: #e3e1e1;
  243. text-align: center;
  244. padding: 1.5rem 0;
  245. margin: 1rem 0 0;
  246. font-size: 1.5rem;
  247. width: 100%;
  248. }
  249. figure img {
  250. max-width: 250px;
  251. max-height: 250px;
  252. border: .5vw solid #323a45;
  253. padding: 1px;
  254. }
  255. figcaption {
  256. padding: 1rem;
  257. line-height: 1.4;
  258. }
  259. aside {
  260. display: flex;
  261. flex-direction: column;
  262. background-color: #e3e1e1;
  263. padding: 1rem 0;
  264. border-bottom: .2vh solid #07486c;
  265. }
  266. aside p {
  267. max-width: 50rem;
  268. margin: 0 auto;
  269. }
  270. /* https://fvsch.com/code/css-locks/ */
  271. p, li, pre, code, kbd, samp, var, tt, time, details, figcaption {
  272. font-size: 1rem;
  273. line-height: calc( 1.5em + 0.2 * 1rem );
  274. }
  275. h1 {
  276. font-size: 1.9rem;
  277. line-height: calc( 1.2em + 0.2 * 1rem );
  278. }
  279. h2 {
  280. font-size: 1.6rem;
  281. line-height: calc( 1.3em + 0.2 * 1rem );
  282. }
  283. h3 {
  284. font-size: 1.35rem;
  285. line-height: calc( 1.4em + 0.2 * 1rem );
  286. }
  287. @media (min-width: 20em) {
  288. /* The (100vw - 20rem) / (50 - 20) part
  289. resolves to 0-1rem, depending on the
  290. viewport width (between 20em and 50em). */
  291. p, li, pre, code, kbd, samp, var, tt, time, details, figcaption {
  292. font-size: calc( 1rem + .6 * (100vw - 20rem) / (50 - 20) );
  293. line-height: calc( 1.5em + 0.2 * (100vw - 50rem) / (20 - 50) );
  294. margin-left: 0;
  295. }
  296. h1 {
  297. font-size: calc( 1.9rem + 1.5 * (100vw - 20rem) / (50 - 20) );
  298. line-height: calc( 1.2em + 0.2 * (100vw - 50rem) / (20 - 50) );
  299. }
  300. h2 {
  301. font-size: calc( 1.5rem + 1.5 * (100vw - 20rem) / (50 - 20) );
  302. line-height: calc( 1.3em + 0.2 * (100vw - 50rem) / (20 - 50) );
  303. }
  304. h3 {
  305. font-size: calc( 1.35rem + 1.5 * (100vw - 20rem) / (50 - 20) );
  306. line-height: calc( 1.4em + 0.2 * (100vw - 50rem) / (20 - 50) );
  307. }
  308. }
  309. @media (min-width: 50em) {
  310. /* The right part of the addition *must* be a
  311. rem value. In this example we *could* change
  312. the whole declaration to font-size:2.5rem,
  313. but if our baseline value was not expressed
  314. in rem we would have to use calc. */
  315. p, li, pre, code, kbd, samp, var, tt, time, details, figcaption {
  316. font-size: calc( 1rem + .6 * 1rem );
  317. line-height: 1.5em;
  318. }
  319. p, li, pre, details {
  320. margin-left: 3rem;
  321. }
  322. h1 {
  323. font-size: calc( 1.9rem + 1.5 * 1rem );
  324. line-height: 1.2em;
  325. }
  326. h2 {
  327. font-size: calc( 1.5rem + 1.5 * 1rem );
  328. line-height: 1.3em;
  329. }
  330. h3 {
  331. font-size: calc( 1.35rem + 1.5 * 1rem );
  332. line-height: 1.4em;
  333. }
  334. figure img {
  335. max-width: 500px;
  336. max-height: 500px;
  337. }
  338. }
  339. figure.unsquared {
  340. margin-bottom: 1.5rem;
  341. }
  342. figure.unsquared img {
  343. height: inherit;
  344. }
  345. @media print {
  346. body { font-size: 100%; }
  347. a:after { content: " (" attr(href) ")"; }
  348. a, a:link, a:visited, a:after {
  349. text-decoration: underline;
  350. text-shadow: none !important;
  351. background-image: none !important;
  352. background: white;
  353. color: black;
  354. }
  355. abbr[title] { border-bottom: 0; }
  356. abbr[title]:after { content: " (" attr(title) ")"; }
  357. img { page-break-inside: avoid; }
  358. @page { margin: 2cm .5cm; }
  359. h1, h2, h3 { page-break-after: avoid; }
  360. p3 { orphans: 3; widows: 3; }
  361. img {
  362. max-width: 250px !important;
  363. max-height: 250px !important;
  364. }
  365. nav, aside { display: none; }
  366. }
  367. ul.with_columns {
  368. column-count: 1;
  369. }
  370. @media (min-width: 20em) {
  371. ul.with_columns {
  372. column-count: 2;
  373. }
  374. }
  375. @media (min-width: 50em) {
  376. ul.with_columns {
  377. column-count: 3;
  378. }
  379. }
  380. ul.with_two_columns {
  381. column-count: 1;
  382. }
  383. @media (min-width: 20em) {
  384. ul.with_two_columns {
  385. column-count: 1;
  386. }
  387. }
  388. @media (min-width: 50em) {
  389. ul.with_two_columns {
  390. column-count: 2;
  391. }
  392. }
  393. .gallery {
  394. display: flex;
  395. flex-wrap: wrap;
  396. justify-content: space-around;
  397. }
  398. .gallery figure img {
  399. margin-left: 1rem;
  400. margin-right: 1rem;
  401. }
  402. .gallery figure figcaption {
  403. font-family: 'ConcourseT3'
  404. }
  405. footer {
  406. font-family: 'ConcourseT3';
  407. display: flex;
  408. flex-direction: column;
  409. border-top: 3px solid white;
  410. padding: 4rem 0;
  411. background-color: #07486c;
  412. color: white;
  413. }
  414. footer > * {
  415. max-width: 50rem;
  416. margin: 0 auto;
  417. }
  418. footer a {
  419. color: #f1c40f;
  420. }
  421. footer .avatar {
  422. width: 200px;
  423. height: 200px;
  424. border-radius: 50%;
  425. float: left;
  426. -webkit-shape-outside: circle();
  427. shape-outside: circle();
  428. margin-right: 2rem;
  429. padding: 2px 5px 5px 2px;
  430. background: white;
  431. border-left: 1px solid #f1c40f;
  432. border-top: 1px solid #f1c40f;
  433. border-right: 5px solid #f1c40f;
  434. border-bottom: 5px solid #f1c40f;
  435. }
  436. </style>
  437. <h1>
  438. <span><a id="jumper" href="#jumpto" title="Un peu perdu ?">?</a></span>
  439. UTC is Enough for Everyone, Right? (archive)
  440. <time>Pour la pérennité des contenus liés. Non-indexé, retrait sur simple email.</time>
  441. </h1>
  442. <section>
  443. <article>
  444. <h3><a href="https://zachholman.com/talk/utc-is-enough-for-everyone-right">Source originale du contenu</a></h3>
  445. <div class="pa6-l pa3">
  446. <div class="w-60-l">
  447. <h2 id="since-the-dawn-of-time">Since the dawn of time</h2>
  448. <p>Years ago, I worked with a friend who had built a few scheduling calendars in a previous freelancing gig.</p>
  449. <p>Sometimes we’d be working on something that tangentially related to time, and as kind of a recurring in-joke he’d always tell me:</p>
  450. <blockquote class="mv4 bg-white black pv4 b--pink bw3 f4">
  451. Zach, whatever you do: just don't <em>ever</em> build a calendar.
  452. </blockquote>
  453. <p>Anyway, I’m Zach Holman and I’m <a href="http://during.com">building a calendar</a>.</p>
  454. <p>I guess I never could follow directions very well.</p>
  455. <p>Building a calendar sucks. Like there’s really cool shit you can do, since every calendar out there today is basically straight outta 2005, but at the end of the day you’re stuck dealing with all of the edge cases that all your dork friends have warned you about since the dawn of time. (Like literally, <em>the dawn of time</em> is a separate edge case you have to account for as well.) So there’s been a lot of heinous stuff we’ve had to work with.</p>
  456. </div>
  457. <div class="flex-l items-start">
  458. <div class="w-60-l">
  459. <p>I’ve made notes of the egregious things I’ve learned about programming with time and pulled them together as a talk. This is the written companion piece, which is sort of a super set of the talk, since I had way more notes than what I could shove in a single talk.</p>
  460. <p>Beyond that, though, there’s also a lot about time itself that is properly hilarious, and it’d be a travesty to not talk about the country that recently decided to skip a certain day, or that the Unix epoch isn’t technically the number of seconds since January 1970, or that February 30 happened at least twice in history.</p>
  461. <p>It turns out humans have had a long, long history of poorly dealing with time, so when you hammer your head against the wall trying to deal with a timezone bug, well, you’re just the last in a long, long line of human beings that are terrible at all this! Congrats. You’re pretty unremarkable.</p>
  462. </div>
  463. <div class="w-40-l mt4 ml4-l bg-white black f6 pa3 br1 lh-copy flex">
  464. <div class="flex-column">
  465. <i class="fal mr3 fa-2x">lightbulb</i>
  466. </div>
  467. <div class="flex-column">
  468. <p class="ma0">I've given this talk three times: at <a href="https://www.youtube.com/watch?v=aEvB98CstOk">RubyConfIndia</a>, RubyConf Australia, and Balkan Ruby. (Don't worry, non-Rubyists; there's no Ruby in this post. The conference topics were just happenstance. Also I love the word "happenstance".)</p>
  469. <p>Each of those talks were filmed, and I'll link to each of them above once the recording's been made available, in case you're more of a watch-and-listen kind of person.</p>
  470. </div>
  471. </div>
  472. </div>
  473. </div>
  474. <div class="video">
  475. <video class="z-1" src="/video/utc-one.mp4" poster="/images/talks/utc/poster-one.jpg" width="100%" preload="" autoplay="" loop="" muted="" playsinline=""></video>
  476. <div class="absolute top-0 white z-2 w-50 mt2 ml5 o-80">
  477. <h1 class="lh-solid">
  478. <div class="bg-yellow black dib tracked-tight avenir tc" style="width: 30vw; font-size: 4vw">What is</div>
  479. <div class="" style="font-size: 12vw">Time?</div>
  480. </h1>
  481. </div>
  482. </div>
  483. <div class="pa6-l pa3 intro">
  484. <div class="w-60-l">
  485. <h2 id="what-is-time">What is time?</h2>
  486. <p>What <em>is</em> time? Well, that’s a question as old as… time.</p>
  487. </div>
  488. <div class="flex-l items-start">
  489. <div class="w-60-l">
  490. <p>But yeah, basically time is like, just a social construct, mannnnnnnnnn. 🌱💨 Physicists are <a href="https://www.quantamagazine.org/a-debate-over-the-physics-of-time-20160719/">still debating on whether or not time actually exists</a> in the universe. This quickly gets us into the territory of asking ourselves really weird things that hurts our brain, like what is time, or what is physics, or if you only eat one donut from Krispy Kreme, did you even actually go there?</p>
  491. <p>So to avoid all of this, I’m just going to say that no, time doesn’t exist, therefor writing code for it doesn’t matter, so boom, we’re done here! Thanks for reading.</p>
  492. <p>Okay you’re not getting out of this that easy. But I think it is worthwhile to take a quick look at the history of time so we can figure out why it’s so goddamn hard to do things with timestamps.</p>
  493. </div>
  494. <div class="w-40-l mt4 ml4-l bg-black white f6 pa3 br1 lh-copy flex">
  495. <div class="flex-column">
  496. <i class="fal mr3 fa-2x">lightbulb</i>
  497. </div>
  498. <div class="flex-column">
  499. <p class="ma0">This stuff gets wild to read more about, in the existential <em>what-even-is-anything-anyway?</em> category of questions in life.</p>
  500. <p>Apparently <a href="https://www.sciencealert.com/physicists-find-as-clocks-get-more-precise-time-gets-more-fuzzy">time gets more fuzzy</a> as clocks get more and more accurate.</p>
  501. <p>Pretty sure this confirms we're living in a simulation, and the programmers were too lazy to fully flesh the code out before they reached their ship deadline.</p>
  502. </div>
  503. </div>
  504. </div>
  505. <div class="w-60-l mt6">
  506. <h2 id="a-brief-timeline-of-time">A brief timeline of time</h2>
  507. <ol class="timeline">
  508. <li>
  509. <span class="bg-black white pa3">4000+ BC</span> Astronomical clocks
  510. <div>We start seeing a bunch of "clocks" pop up. But like, they were shitty clocks: basically they'd be like the equivalent of looking up, seeing a sun, and like boom, I guess it's daytime.</div>
  511. </li>
  512. <li>
  513. <span class="bg-black white pa3">1500 BC</span> Sundial subdivisions
  514. <div>
  515. <p>Oh rad, now we start getting some nifty stuff. We start seeing more sundials split up into subdivisions, so we can be more specific about how far through the day we are.</p>
  516. <p>Egypt was the first ones to really start doing this: they had a duodecimal system already, so that's why it was split as base twelve, or our two parts of twelve hours in a day.</p>
  517. <p>If you're like me and immediately said <em>ohhhhhhhhhhhh, so THAT'S why there's twelve hours in a day!</em> and immediately followed it up with: <em>wait, why the fuck are they using twelve instead of ten? Base ten is lit and doing everything in twelve feels so uncivilized</em>, well good use of "lit" there.</p>
  518. <p>It's most likely because <a href="https://www.scientificamerican.com/article/experts-time-division-days-hours-minutes/">you have twelve joints in your hands</a>: three in each of the four fingers, excluding the thumb. I thought that was pretty nifty to discover. Like, I had never looked at my hands before, really. Hands are really wild, when you think about it. 🌱💨</p>
  519. </div>
  520. </li>
  521. <li>
  522. <span class="bg-black white pa3">14th century</span> Fixed-length hours
  523. <div>
  524. <p>European clocks started standardizing on fixed-length hours; before, a lot of clocks would change the duration of an hour depending on the season.</p>
  525. <p>Basically anything with time that seems weird like this can probably be summed up with "the goddamn farmers did it", since, you know, growing seasons were really important to figure out when you couldn't just walk down the block and go to a Taco Bell Cantina® for a Baja Blast™.</p>
  526. </div>
  527. </li>
  528. <li>
  529. <span class="bg-black white pa3">16th century</span> Minutes
  530. <div>
  531. <p>Wasn't until around the 16th century before we started seeing minutes. Before then, nobody really cared, and mechanical clocks weren't good enough to count 'em accurately, anyway.</p>
  532. <p>Probably around this time your first boss's ancestors were also discovering minutes as a good way to make sure your ancestors got to work on time: "You're exactly 56 minutes late today, Holman, what the fuck is wrong with you? Go shave the sheep!"</p>
  533. </div>
  534. </li>
  535. <li>
  536. <span class="bg-black white pa3">17th century</span> Seconds
  537. <div>
  538. <p>Did you hear about the clock maker who was the first to add a second hand to a clock?</p>
  539. <p>His first prototype was a complete failure, but he got it working the second time.</p>
  540. </div>
  541. </li>
  542. <li>
  543. <span class="bg-black white pa3">1883</span> USA standardizes time
  544. <div>
  545. <p>We start seeing some actual standardization on time itself.</p>
  546. <p>In what is the most bourgeoisie example of the most bourgeoisie era, a bunch of rich, white railroad tycoons met at a fancy Chicago hotel to agree on a standard timezone so their trains would work better together. They used the new-fangled telegraph to synchronize time signals between cities.</p>
  547. <p>Other countries would do the same thing around this era. Previously, it was basically a free for all as to what time it would be in any given city:</p>
  548. <blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">Lamenting over timezone programming led me to this 1857 chart, and suddenly timezones seem GREAT. (At noon in DC, it was 12:08 in Philly!) <a href="https://t.co/mSYyUKL6lX">pic.twitter.com/mSYyUKL6lX</a></p>&mdash; Tess Rinearson (@_tessr) <a href="https://twitter.com/_tessr/status/900870734238449664?ref_src=twsrc%5Etfw">August 25, 2017</a></blockquote> <script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
  549. <p>So, consider yourself playing in easy mode today. You can't <em>imagine</em> how much harder it would be to be a JavaScript programmer in 1882.</p>
  550. </div>
  551. </li>
  552. <li>
  553. <span class="bg-black white pa3">1967</span> Atomic standard
  554. <div>
  555. <p>The world started standardizing on what time measurements actually <em>are</em>.</p>
  556. <p>If you have a pile of Cesium atoms sitting in your backyard, go out sometime and measure <a href="https://www.nist.gov/pml/walk-through-time-atomic-age-time-standards">9,192,631,770 energy transitions of a single atom of Cesium</a>: because that is exactly the duration of a second, settled upon in 1967 by a bunch of scientists.</p>
  557. <p>Nowadays, our atomic clocks are accurate to losing a single second over the course of a few hundred million years. This is something like only losing two nanoseconds of accuracy a month, which definitely accounts for why I'm always late to your meetings on Monday morning.</p>
  558. <p>The clocks being worked on today, though, are even better: optical clocks "tick" about a hundred thousand times faster than atomic clocks, which can lead to way higher accuracy. Basically if you somehow started one of these bad boys right at the Big Bang about 14 billion years ago and somehow kept it going, it would have <a href="https://physicsworld.com/a/new-optical-clock-breaks-accuracy-record/">only lost a few seconds of accuracy</a>.</p>
  559. </div>
  560. </li>
  561. <li>
  562. <span class="bg-black white pa3">2018</span> You fuck up yet another timezone bug
  563. <div>
  564. You didn't think I'd forget about you, did you?
  565. </div>
  566. </li>
  567. </ol>
  568. </div>
  569. </div>
  570. <div class="intro">
  571. <div class="white tc f3">
  572. <span class="fal fa-spin fa-pulse mh3">clock</span>
  573. <span class="fal fa-spin mh3">hourglass-start</span>
  574. <span class="fal fa-spin fa-pulse mh3">watch</span>
  575. <span class="fal fa-spin mh3">alarm-clock</span>
  576. <span class="fal fa-spin fa-pulse mh3">stopwatch</span>
  577. </div>
  578. </div>
  579. <div class="pa6-l pa3 intro">
  580. <div class="flex-l">
  581. <div class="w-60-l">
  582. <p>Everything we just covered revolves around a single question:</p>
  583. <h2 id="what-time-is-it">What time is it?</h2>
  584. <p>At a certain point we started asking this question. This became important to know when you could finally head home after work, for example (answer: never early enough). And for a long time that was fine, but that wasn’t <em>entirely</em> the question we were asking. There was a hidden implicit part of the question we were never asking:</p>
  585. <p><span class="ml3"><strong>What time is it <em>here</em>?</strong></span></p>
  586. <p>Once we started getting planes and trains and automobiles, we had movement, we had transportation, we could be in two distant places within hours. So we started asking this question:</p>
  587. <p><span class="ml3"><strong>What time is it <em>there</em>?</strong></span></p>
  588. <p>This question ruined everything.</p>
  589. <p>Now we had to deal not just with one time (here), not two times (here and there), but a multitude of times, all interacting with each other (everywhere). This complicated everything, and made obvious the notion that writing timezone code was some of the worst things you have to do in our field.</p>
  590. <p>It’s so predictable that developers will pooh-pooh having to write timezone code, almost as much as it is predictable that some clueless commenter on Hacker News will complain that this page has autoplaying video on it. And then someone will calmly quote this passage in response, quietly pleased with themselves that the initial commenter was rude and certainly didn’t read the post at all. Then a third person will chime in on the thread saying the author was playing you all like a fiddle anyway, and the real problem is that the post was way too long to start with.</p>
  591. </div>
  592. <div class="pa5 mv4 w-40-l">
  593. <a href="https://en.wikipedia.org/wiki/File:Universal_Dial_Plate_or_Times_of_all_Nations,_1854.jpg" class="no-slide"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d8/Universal_Dial_Plate_or_Times_of_all_Nations%2C_1854.jpg/757px-Universal_Dial_Plate_or_Times_of_all_Nations%2C_1854.jpg" /></a>
  594. <em class="f6">This is terrifying. It's a <a href="https://en.wikipedia.org/wiki/File:Universal_Dial_Plate_or_Times_of_all_Nations,_1854.jpg">"Universal Dial Plate"</a>, showing times of individual cities of the world, from 1854. Gulp.</em>
  595. </div>
  596. </div>
  597. <div class="mt5 w-60-l">
  598. <h2 id="timezones">Timezones</h2>
  599. <p>So you’re starting out fresh, building a completely new global time structure.</p>
  600. <p>Clearly, since you’re a programmer, you already have an innate distrust of timezones, so you’re going to get rid of them entirely, a la <a href="https://en.wikipedia.org/wiki/Swatch_Internet_Time">Swatch Internet Time</a>, which demonstrates why you are the beautiful human you are, you dashing human you.</p>
  601. <p>In fact, the title of this post is wrong: UTC isn’t enough for everyone; you should get rid of UTC and move all your servers to use Swatch Internet Time instead.</p>
  602. <p>Okay, now that we got that tomfoolery out of the way, we start asking questions about what time should look like. And if we do have timezones, the obvious thing to you is to split the world up into twenty four timezones, one for each hour in the day, so it’s all very neat and orderly.</p>
  603. <p>Spoiler alert! Nothing is neat and orderly when it comes to time. There’s something like 39 timezones at time of writing.</p>
  604. <p>This, like all of the problems with time, is political. Timezones get added gradually, over time, depending on political whims, geographical reality, and economic plausibility (more on a lot of these later). So, as a common theme you’ll see, this is just one example where we try to graft an irregular system (time and timezones) over a regular system (the duration from time point A to time point B).</p>
  605. <p>This stuff moves a lot, too: the <a href="https://en.wikipedia.org/wiki/Tz_database">tz database</a> (also known as the Olson database), which is the listing of timezone rules we use as programmers to calm this chaos, gets updated many times a year.</p>
  606. <p>It’s also worthwhile to point out here that timezones aren’t tied to hours: many timezone offsets happen at 30 minutes, 45 minutes, and so on. So we need to stop thinking purely about “hours” and start thinking about offsets, in a way.</p>
  607. <p>Timezones are weird. Time is weird.</p>
  608. </div>
  609. </div>
  610. <div class="video">
  611. <video class="z-1" src="/video/utc-two.mp4" poster="/images/talks/utc/poster-two.jpg" width="100%" preload="" autoplay="" loop="" muted="" playsinline=""></video>
  612. <div class="absolute top-0 white z-2 w-100 mt2 o-80">
  613. <h1 class="lh-solid">
  614. <div class="white dib tracked-tight avenir" style="margin-left: 30%; font-size: 4vw">Why</div>
  615. <div class="georgia i" style="font-size: 12vw; margin-left: 30%">Time</div>
  616. <div class="dib bg-blue black dib f1 tracked tc ph4" style="font-size: 5vw; margin-left: 35%">is so hard</div>
  617. </h1>
  618. </div>
  619. </div>
  620. <div class="pa6-l pa3 bg-blue blue">
  621. <div class="w-60-l">
  622. <h2 id="who-needs-december-30-2011-anyway">Who needs December 30, 2011 anyway</h2>
  623. <p>Let me tell you a quick story.</p>
  624. <p>Do you remember what you were doing on December 30, 2011? You have three seconds. Go.</p>
  625. <p>Nope? Nothing? Well then, if you don’t know what you were doing December 30, 2011, then there’s one obvious explanation for this: <strong>you must be Samoan</strong>.</p>
  626. <p>You see, Samoa didn’t have December 30, 2011. They went straight from December 29 to December 31, do not pass Go, do not collect $200.</p>
  627. <div class="shadow-1 mv4">
  628. <video class="db" src="/video/utc-samoa.mp4" poster="/images/talks/utc/poster-samoa.jpg" width="100%" preload="" autoplay="" loop="" muted="" playsinline=""></video>
  629. </div>
  630. <p>Samoa used to be east of the International Date Line. I mean, it still is (they didn’t physically move the country, which would be a pretty impressive feat, now that I think of it), but it used to actually follow the date line accordingly. In the years before 2011, Samoa looked up and realized that hey, most of our major trading partners — China, Australia, New Zealand, and the like — are on the <em>other</em> side of the date line, so when we’re dutifully working away at the office on Friday, the rest of the people we actually do business with have already fucked off for the weekend. The Kiwis are probably off grilling meat somewhere, never to be heard from until Monday, if we’re <em>lucky</em> to hear from them ever again at all.</p>
  631. <p>So Samoa decided to change timezones so that they could line up better economically.</p>
  632. <p>It’s also important to note that Samoa is about 100km away from American Samoa. Not super far at all.</p>
  633. <p><img src="/images/talks/utc/samoa-american-samoa.png" alt="Samoa and American Samoa map" /></p>
  634. <p>So at this point in my talk I say the next part <em>real fast</em>, so like, just read it real fast and we’ll try to approximate me. It’s best if you do a pile of cocaine before reading the next part. I’ll wait.</p>
  635. <p>Okay, so:</p>
  636. <div class="f5 ph4">
  637. <p>At the start, Samoa and American Samoa were in the same timezone, the <em>Samoa Time Zone</em>, which encompasses the two different countries, except it’s actually one country and one unincorporated territory of the United States (American Samoa), so when Samoa pulled out of this time zone it switched to the <em>West Samoa Time Zone</em> which was UTC +12:00 compared to <em>Samoa Time Zone</em> which stayed at UTC -11:00 which meant West Samoa Time Zone was 24 hours ahead of Samoa Time Zone which isn’t entirely accurate because sometimes it would be 25 hours ahead of Samoa Time Zone because Samoa Time Zone doesn’t observe Daylight Saving Time and, of course, West Samoa Time Zone also doesn’t observe Daylight Saving Time except it <em>does</em> observe it starting in 2009, wait that’s not true they had to push that back to 2010 because of the Samoa Earthquake and Tsunami which messed everything up; now naturally all of this may sound familiar to you because this is the mirror reverse of what happened on July 4, 1892 when the <em>opposite</em> happened when they looked around and said hey our major trading partner is the United States, why are we in a totally different day than these Yanks, so let’s do July 4, 1892 twice (which is doubly awesome and hella <em>🇺🇸 🎆 P A T R I O T I C 🎇 🗽</em>, since it’s Independence Day in the USA); it’s also important to note that Tokelau, a nearby territory of New Zealand, saw all this happening so they got in on the action and did the same thing and moved to West Samoa Time also on December 30, 2011.</p>
  638. </div>
  639. <p>When all of this happened, <a href="http://www.bbc.co.uk/news/mobile/world-asia-16351377">the BBC sent a journalist to Samoa</a> to see how they were taking it:</p>
  640. <blockquote>
  641. <p>You can hear the sound of a lot of vehicles going round town, going round the town centre clock and tooting their horns. People screaming.</p>
  642. <p>“We have once again achieved another milestone in our history of Samoa.”</p>
  643. </blockquote>
  644. <p>I don’t know who they interviewed for this piece, but what I do know is whoever said this thing never had to fucking deal with fucking timezone exceptions in code before. Fuck.</p>
  645. <p>Working with time is hard. There can be little edge cases like this every step of the way.</p>
  646. </div>
  647. </div>
  648. <div class="bg-blue">
  649. <div class="white tc f3">
  650. <span class="fal fa-spin fa-pulse mh3">clock</span>
  651. <span class="fal fa-spin mh3">hourglass-start</span>
  652. <span class="fal fa-spin fa-pulse mh3">watch</span>
  653. <span class="fal fa-spin mh3">alarm-clock</span>
  654. <span class="fal fa-spin fa-pulse mh3">stopwatch</span>
  655. </div>
  656. </div>
  657. <div class="pa6-l pa3 bg-blue blue">
  658. <div class="w-60-l">
  659. <h2 id="no-russian">No Russian</h2>
  660. <p>The Russian Olympic shooting team, pleased to represent their country on <em>The Big Stage</em>, was proud to head to London for the Games in 1908. They hit the road… <a href="https://www.reddit.com/r/todayilearned/comments/6ltsnz/til_in_1908_the_russian_olympic_team_arrived_at/?st=J4UA4D2H&amp;sh=fe9e2e7a">and made it to London twelve days too late</a> and missed their event.</p>
  661. <p>Turns out, in 1918, Russia switched to the Gregorian calendar. This was neat, because that moved yet another country to using Gregorian, so we could all be on the same page.</p>
  662. <p>In 1908, though, they were still on the Julian calendar. England, the host of the Olympics, was on the Gregorian calendar. So when they told them to show up at a certain date, the two calendars didn’t match up. Whoops.</p>
  663. <p>This mix-up was a bummer, but possibly not too unfamiliar for Russia, as the same thing happened in 1805 during the <a href="https://en.wikipedia.org/wiki/Battle_of_Austerlitz">Battle of Austerlitz</a>. Napoleon was doing his thing and invading Austria, and the Austrians, assured that Russian reinforcements would show up, you know, in time, was sad to also discover the woes of different calendars as reinforcements showed up twelve days too late. Napoleon ended up winning.</p>
  664. </div>
  665. </div>
  666. <div class="bg-blue">
  667. <div class="white tc f3">
  668. <span class="fal fa-spin fa-pulse mh3">clock</span>
  669. <span class="fal fa-spin mh3">hourglass-start</span>
  670. <span class="fal fa-spin fa-pulse mh3">watch</span>
  671. <span class="fal fa-spin mh3">alarm-clock</span>
  672. <span class="fal fa-spin fa-pulse mh3">stopwatch</span>
  673. </div>
  674. </div>
  675. <div class="pa6-l pa3 bg-blue blue">
  676. <div class="w-60-l">
  677. <p>Other interesting factoids that I could expand upon, you know, if only I had the <em>time</em>:</p>
  678. <ul>
  679. <li><a href="https://www.timeanddate.com/date/february-30.html">February 30 happened at least twice</a> in history.</li>
  680. <li><a href="https://www.reddit.com/r/askscience/comments/6c3t0s/if_each_day_is_only_23h56m4s_over_the_course_of_4/">An Earth “day” is different</a> from the time that it takes for the Earth to rotate on its axis once. This is because the Earth is <em>also</em> rotating around the sun at the same time, so that measurement is actually something like 361° of rotation instead of the normal 360°.</li>
  681. <li>You ever forget if “12am” means noon or midnight? I always felt stupid having to think about this every time, but I feel less bad after reading this <a href="https://ell.stackexchange.com/a/152729">excellent Stack Exchange answer</a> that details the entire history of this. My favorite part: the United States government decreed that “12am” meant “noon”… up until 2008, when the United States Government Printing Office reversed their position and swapped to using “12pm” as “noon”.</li>
  682. </ul>
  683. <p>Time is hard, and you’re not the only one screwing all this stuff up.</p>
  684. </div>
  685. </div>
  686. <div class="video">
  687. <video class="z-1" src="/video/utc-three.mp4" poster="/images/talks/utc/poster-three.jpg" width="100%" preload="" autoplay="" loop="" muted="" playsinline=""></video>
  688. <div class="absolute top-0 white z-2 w-50 mt2 ml5 o-80">
  689. <h1 class="lh-solid flex items-center">
  690. <div class="bg-green black dib tracked-tight avenir" style="padding: 0 2vw; margin-top: -10vw; font-size: 6vw">Code</div>
  691. <div class="dib white" style="font-size: 30vw">&amp;</div>
  692. <div class="bg-green white i dib tracked-tight avenir" style="padding: 0 2vw; margin-top: 10vw; font-size: 6vw">Time</div>
  693. </h1>
  694. </div>
  695. </div>
  696. <div class="pa6-l pa3 bg-green green">
  697. <div class="flex-l items-start">
  698. <div class="w-60-l">
  699. <p>While I was initially building this talk, I found myself listening to the words of my absolute favorite modern-day philosopher: Nas.</p>
  700. <blockquote>
  701. <p>You got CD-ROM, everythang operates by computers</p>
  702. <p>Then what happens when circuit breaks?</p>
  703. <p>Y2K’s the big scare</p>
  704. <p>Scientists say we ain’t prepared</p>
  705. <div class="mt4 tr i fw5">- Nas, "New World", 1999</div>
  706. </blockquote>
  707. <p>I’m not really sure what to take from all this, other than if Nas is really concerned about computer science and how it relates to time, then dammit, we should be concerned, too.</p>
  708. </div>
  709. <div class="w-40-l ml4-l">
  710. <img src="/images/talks/utc/nas.png" class="shadow-0" alt="Nasty Nas" />
  711. </div>
  712. </div>
  713. </div>
  714. <div class="pa6-l pa3 pt3-l bg-green green">
  715. <div class="w-60-l">
  716. <h2 id="storing-time">Storing Time</h2>
  717. <p>The very first thing you need to start worrying about when you build smart, time-aware software is how you store time. For many, databases will be the tool they’ll reach for. And there’s a lot of things to consider when it comes to <em>how</em> you store that data in a database.</p>
  718. <p>Step one: <strong>use UTC</strong>. Okay I’m not going to suddenly say all this advice we’ve been giving for years and years is wrong. UTC is a fine standard to base all your times off of. So use it. Don’t do something silly and <a href="https://twitter.com/awscloud/status/997174917908004864?lang=en">change your servers’ timezones from UTC</a>.</p>
  719. <p>Now, I’ve been burying the lede here for quite some time. It’s worthwhile to talk quickly about UTC, and why it’s a good default when we tell developers “Just use UTC”.</p>
  720. <p>UTC, of course, stands for:</p>
  721. <div class="courier">
  722. <blockquote>
  723. <p> <strong>U</strong>niversal<br />
  724. Coordina<strong>T</strong>ed…?<br />
  725. <del> <strong>C</strong> </del> um… lemme figure this out…
  726. <b>T</b>ime?<br /></p>
  727. </blockquote>
  728. </div>
  729. <p>Time standards bodies got us making scratch pads like some Zodiac Killer letter. Didn’t even know Ted Cruz cared about timezone issues.</p>
  730. <p>But yeah, this <code class="highlighter-rouge">UTC</code> initialism doesn’t make any sense. Let’s dig into this a little more.</p>
  731. <p>So you’ve got a bunch of scientist types around 1960 who are like, hey, time is all screwy we should totes make a standard. And some of them spoke English, and some of them spoke French, which, of course, is the cause of so much conflict over so many generations. (In hindsight, maybe we should have split all those troublemakers up from the start.)</p>
  732. <p>The English-speaking folk were like yo, this definitely sounds like <strong>Coordinated Universal Time</strong>, boom, ship it. And the French speakers were like yeah that makes total sense! <strong>Temps Universel Coordonné</strong> DOES work out well in our language, too, ship it! Then they both looked up and realized cool, they’ve created both <strong>CUT</strong> and <strong>TUC</strong> for acronyms. Shit.</p>
  733. <p>When your standard — that is expressly meant to <em>standardize</em> time — doesn’t even standardize on a standard <em>acronym</em>, well, damn, that probably doesn’t bode well for your standard.</p>
  734. <p>Or, actually, now that I think about it, this might be the most perfect metaphor about time itself ever created. Maybe we should give them some credit for that. Time never makes sense.</p>
  735. <p>Anyway, the compromise that arose was that if everyone is special, <em>no one is special</em>, so they created an entirely new set of letters that has no direct relation to any real words for the compromise: <strong>UTC</strong>.</p>
  736. <p>Whew.</p>
  737. <p>So. We use UTC because it has an <em>offset</em> of 00:00: in other words, it has no timezone offset. Other timezones are offset from <em>UTC</em>, not the other way around.</p>
  738. <p>It’s important to note that UTC is <em>not</em> GMT. GMT is Greenwich Mean Time, which historically was the center of time in the world. They both have an offset of 00:00. But you shouldn’t use GMT on your server, for example, because UTC is a <em>standard</em>, but GMT is a <em>timezone</em>. People actually live in locations whose time is GMT; UTC isn’t directly used by people (unless they’re really weird).</p>
  739. </div>
  740. <div class="flex-l items-start">
  741. <div class="w-60-l">
  742. <p>This may sound like such a small difference of wankery, but the more relevant part is that <em>some</em> users of GMT observe Daylight Saving Time (but not all). UTC has no concept of Daylight Saving Time at all. So if you base everything in GMT, well, who knowssss what will happen.</p>
  743. </div>
  744. <div class="w-40-l mt4 ml4-l bg-dark-green f6 pa3 br1 lh-copy flex">
  745. <div class="flex-column">
  746. <i class="fal mr3 fa-2x">lightbulb</i>
  747. </div>
  748. <div class="flex-column">
  749. <span class="fw5">Quick side note</span>: it's Daylight <em>Saving</em> Time, not Daylight <em>Savings</em> Time. You don't want to sound like a total tool in front of all six of us who care about this stuff.
  750. </div>
  751. </div>
  752. </div>
  753. <div class="w-60-l">
  754. <p>One question you might want to ask right from the start is: <strong>do you really <em>need</em> to store time?</strong></p>
  755. <p>As programmers, we’re kind of inherently built to want the ABSOLUTE BEST HIGHEST FIDELITY FORMATS OF ALL TIME. Like dammit, I <em>need</em> the timestamp down to the micromillinanosecond for every cheeseburger that gets added to my bespoke <em>Watch-The-BK-Throne</em> app. If I do not have this exact knowledge to the millisecond of when I consumed this BBQ Bacon WHOPPER® Sandwich From Burger King® I may die.</p>
  756. <p>But we sometimes don’t need all this data, and that’s cool, so be sure to ask yourself if you really need this data, or you just want this data. The rule of the game for programming with time is that you should opt to go as simple as possible as soon as possible. A good example of this are birthdays. Birthdays are kind of like floating events; it doesn’t really matter where you are on the planet; if the numerical day matches up with what’s on your driver’s license we’re set. Storing these things as a timestamp column instead of just a date column in your database can end up complicating your code down the line.</p>
  757. <h3 id="properly-storing-timezone-aware-times">Properly storing timezone-aware times</h3>
  758. <p>On the other hand, you may actually want to track time. In those cases, there’s a few ways of doing this, particularly if you know that fidelity of hour or minute is going to be important for your use case.</p>
  759. <p>Say you have an <code class="highlighter-rouge">events</code> table in your database, and you toss in a column to keep track of when the event starts:</p>
  760. <table class="bg-white mv4 center w-75 ">
  761. <thead>
  762. <th>Name</th>
  763. <th>Type</th>
  764. </thead>
  765. <tr class="striped--near-white">
  766. <td class="pa2">starts_at</td>
  767. <td class="pa2">timestamp</td>
  768. </tr>
  769. </table>
  770. <p>This is neat and obvious, since you want to store a time as a timestamp in whatever database you’re using. But if it’s important that you don’t end up being an hour off when something actually happened, you’d need to store the originating timezone as well:</p>
  771. <table class="bg-white mv4 center w-75 ">
  772. <thead>
  773. <th>Name</th>
  774. <th>Type</th>
  775. </thead>
  776. <tr class="striped--near-white">
  777. <td class="pa2">starts_at</td>
  778. <td class="pa2">timestamp</td>
  779. </tr>
  780. <tr class="striped--near-white">
  781. <td class="pa2">starts_at_tz</td>
  782. <td class="pa2">string</td>
  783. </tr>
  784. </table>
  785. <p>By adding the offset as a string in your database, you gain some additional powers. For one, it gives you a closer idea of when <em>specifically</em> the event happened.</p>
  786. </div>
  787. <div class="flex-l items-start">
  788. <div class="w-60-l">
  789. <p>One way to do this is to treat this column as an integer; say, store <code class="highlighter-rouge">-240</code> in a row to represent a shift of 4 hours (4*60 minutes). That’s cool, and it does get you closer, but again, we’re talking about a use case where it actually does matter to be as accurate as possible (and being off an hour might lead to nonsensical data). Just having a numerical offset doesn’t give you fidelity of location. Was it during Daylight Saving Time? What about comparing that to today’s time; do we account for DST or not? Also, do we need to account for changes in timezones that might have happened since that point in time?</p>
  790. <p>Instead of a numeric offset, use a string. Specifically, use the <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">full qualified name</a> in the Olson database, so something like <code class="highlighter-rouge">Australia/Adelaide</code> or <code class="highlighter-rouge">America/Los_Angeles</code>. These are standardized descriptors of the timezones used in the world, and you can use these in pretty much every programming language ever used in the last few decades.</p>
  791. <p>Again, all of this probably isn’t relevant for <em>every</em> app — who cares if someone’s browsing the article <em>Brad Pitt’s Beautifully Coiffed Hair: Friend or Foe to the Proletariat?</em> and my six comments are <em>technically</em> listed as an hour earlier than they actually were. Regardless of timing, my comments were perfectly relevant and explored the issue perfectly. But for some apps it might make sense to get this detailed, particularly if you’re comparing a lot of times to each other (like, say, a calendar).</p>
  792. </div>
  793. <div class="w-40-l mt4 ml4-l bg-dark-green f6 pa3 br1 lh-copy flex-ns">
  794. <div class="flex-column">
  795. <i class="fal mr3 fa-2x">lightbulb</i>
  796. </div>
  797. <div class="flex-column">
  798. The historical side of this stuff gets kinda cool, too. One of my favorite examples is in <a href="https://tools.ietf.org/html/rfc3339#page-9">RFC 3339</a>:
  799. <div class="mv4 f7 bl b--white bw2 pl3">
  800. <b>1937-01-01T12:00:27.87+00:20</b><br /><br />
  801. This represents the same instant of time as noon, January 1, 1937,
  802. Netherlands time. Standard time in the Netherlands was exactly 19
  803. minutes and 32.13 seconds ahead of UTC by law from 1909-05-01 through
  804. 1937-06-30. This time zone cannot be represented exactly using the
  805. HH:MM format, and this timestamp uses the closest representable UTC
  806. offset.
  807. </div>
  808. So if you really get down into the rabbit hole and find yourself needing historically-accurate times across decades, you might need to backtrack over multiple previous timezone changes in order to get to that point.
  809. Also if you find yourself at this critical juncture, you might want to just give up programming entirely, because that sounds horrible.
  810. </div>
  811. </div>
  812. </div>
  813. <div class="mt5 flex-l items-start">
  814. <div class="w-60-l">
  815. <h2 id="transiting-time">Transiting Time</h2>
  816. <p>Aight, cool, you’re storing your times correctly; now we can take a look at how we transit those times to our clients.</p>
  817. <p>Number one rule: <strong>stay consistent</strong>.</p>
  818. <p>The number one way to address that number one rule: <a href="https://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a>.</p>
  819. <p>ISO 8601 is one of my favorite standards and/or RFC out there. And yes, you <em>should</em> definitely have a favorite. (My all-time fave is <a href="https://tools.ietf.org/html/rfc2606">RFC 2606</a>, thanks for asking! I’m in awe of that absolute unit. Where would we be without that banger? We’d be in complete fucking chaos, that’s where.)</p>
  820. <p>ISO 8601 was a standard that came out in 1988, so it’s probably older than all you lot who are reading this, now get off my damn Friendster lawn. It was re-upped in 2004, 2014, and is anticipating a new draft by the end of this year. It basically defines THE way of writing a timestamp.</p>
  821. <p>Here: I’ll even be nice and show you an example:</p>
  822. <div class="ml4 f4 fw5">
  823. <script type="text/javascript">
  824. document.write(new Date().toISOString())
  825. </script>
  826. </div>
  827. <p>In JavaScript land, this is simple: it just uses the <code class="highlighter-rouge">toISOString()</code> function:</p>
  828. <div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">new</span> <span class="nb">Date</span><span class="p">().</span><span class="nx">toISOString</span><span class="p">()</span>
  829. </code></pre></div> </div>
  830. <p>The astute among you might see a few reasons right away why this is such a dope format:</p>
  831. <ul>
  832. <li><strong>Easy sorting</strong>: It arranges all components from large to small, so pretty much any novice in a programming language could easily sort a list of timestamps from latest to oldest.</li>
  833. <li><strong>Timezone information</strong>: At the far end it includes the offset: <code class="highlighter-rouge">-08:00</code>, for example (well, not in this above example specifically, since in JavaScript you’d also need to parse this out manually with <code class="highlighter-rouge">getTimezoneOffset()</code>). This isn’t as high-fidelity as when we were talking earlier about storing the qualified string version of a timezone, but it does give us information we wouldn’t have otherwise. You don’t get this if you pass around <a href="https://en.wikipedia.org/wiki/Unix_time">UNIX epoch time</a>, for example.</li>
  834. <li><strong>No locale problems</strong>: You don’t have problems with Month/Day/Year formats getting confused with Day/Month/Year formatted dates. More on this in a few.</li>
  835. </ul>
  836. <p>So yeah, use ISO 8601 over the wire. It’s the most popular way of tackling a shared standard for time, so don’t be the jerk who does it in some fancypants custom manner.</p>
  837. <h3 id="rfc-3339">RFC 3339</h3>
  838. <p>Wanted to mention <a href="https://tools.ietf.org/html/rfc3339">RFC 3339</a> briefly as well, since sometimes you’ll see its mean mug pop up in APIs and other spots from time to time.</p>
  839. <p>RFC 3339 came out in 2002. This is a simplification, but it’s kind of a subset of ISO 8601. It requires timestamps — ISO 8601 allows you to omit them and just use it for a date — and in general it’s slightly more strict. It lets you get away with less.</p>
  840. <p>Effectively they’re sort of interchangeable. Most people and API platforms just say they comply with ISO 8601, so that’s probably going to be fine for you, too.</p>
  841. </div>
  842. <div class="w-40-l mt4 ml4-l f6 pa3 br1 lh-copy flex">
  843. <a href="https://xkcd.com/1179/" class="no-slide"><img alt="xkcd on ISO 8601" title="ISO 8601 was published on 06/05/88 and most recently amended on 12/01/04.
  844. See, that's the actual xkcd alt text for this; you didn't think I'd manually add it in this embed, did you. Well you're in luck: I did. Just for you, the xkcd obsessive. &lt;3" src="https://imgs.xkcd.com/comics/iso_8601.png" /></a>
  845. </div>
  846. </div>
  847. <div class="mt5 w-60-l">
  848. <h2 id="displaying-time">Displaying Time</h2>
  849. <blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">British press corp is locked outside the White House because our birthdates were submitted in UK format and secret service don&#39;t get it. 🇬🇧</p>&mdash; Jim Waterson (@jimwaterson) <a href="https://twitter.com/jimwaterson/status/825017459530936320?ref_src=twsrc%5Etfw">January 27, 2017</a></blockquote>
  850. <script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
  851. <p>You’ve got some time, you’ve sent it to the client or to the user… now you have to display it, with hopefully minimal amount of confusion with the United States Secret Service.</p>
  852. <p>I don’t know if you’ve noticed this yet, but Americans aren’t perfect. We use this fucked up date format, MM/DD/YYYY. Like under no circumstances does this make any sense. But if you switch that around and try to show someone from the US a date like 24/6/18… well that’s just going to be weird. People like their locale-based date formatting, and you should try to respect that as much as you can.</p>
  853. <p>One of the ways you can do this on the web is using the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl"><code class="highlighter-rouge">Intl</code> API</a>. <code class="highlighter-rouge">Intl</code> supports a number of different hooks and abilities to handle locale- and language-based changes for numbers, plurals, and dates and times.</p>
  854. <p>Beyond that, if you’re going to be doing anything fancier with dates and times beyond, say, just printing something to the page, you should really start using a proper time library. Things like adding two dates together while still tracking DST and a multitude of other time rules… well, it’s all really difficult to do yourself. Stand on the shoulders of giants, and steal from someone else. Just how Open Source was intended.</p>
  855. <p>Some solid libraries to take a gander at:</p>
  856. <ul>
  857. <li><a href="https://momentjs.com">moment.js</a> The classic time library in JavaScript. Date manipulation, formatting, pretty much everything you’d need.</li>
  858. <li><a href="https://date-fns.org">date-fns</a> More modern approach to a moment.js-like experience for handling dates on the web.</li>
  859. <li><a href="https://github.com/github/time-elements">github/time-elements</a> Web component extension to the <code class="highlighter-rouge">&lt;time&gt;</code> element. Also includes auto-updating timestamps, as well as some locale help.</li>
  860. </ul>
  861. </div>
  862. <div class="w-60-l mt5">
  863. <h2 id="accessibility">Accessibility</h2>
  864. <p>There’s something that tends to be left out of discussions about time (or discussions about any technology, really): accessibility. There’s a few things here that you can do for your human users and computer users that’ll help everyone out.</p>
  865. <p>In a lot of hip social apps, you’ll have something like this:</p>
  866. <p><img src="/images/talks/utc/social-mockup.png" alt="Mockup of social app" /></p>
  867. <p>And on the bottom footer of that component you’ll frequently see a relative datestamp:</p>
  868. <p><img src="/images/talks/utc/relative-datestamp.png" alt="Relative datestamp" /></p>
  869. <p>That’s all well and good, but there’s a few problems with this. For one, this doesn’t automatically update on-page, so if you open the page in a tab an hour ago, it’ll still show something as happening a couple minutes ago. Step one might be to have a lightweight timer on your page that auto-updates all relative date/times and updates them every minute. Keeps everything fresh.</p>
  870. <p>Secondly, as time moves on you’ll start seeing a lot of stuff like this:</p>
  871. <p><img src="/images/talks/utc/relative-year.png" alt="Relative year" /></p>
  872. <p>I always hate stuff like this, because I’m always like, well, when the fuck did this actually happen? Like does this mean five months ago and they’re rounding up to a year? Or does it mean 23 months ago, which is wayyyy different from five months ago? WHAT DOES “ABOUT” MEANNNNN?</p>
  873. <p>A few things you can use here. One of the things I always liked about GitHub is that they’ve always shown a full timestamp in the <code class="highlighter-rouge">title</code> of any relative time on-page. I think we started adding that way back in 2010 or so, something like that. Always made it really easy to find out when specifically some event happened: you just mouseover the element.</p>
  874. </div>
  875. <div class="w-80-l mv4">
  876. <video class="shadow-2" src="/video/utc-github-relative-titles.mp4" poster="/images/talks/utc/poster-github-relative.jpg" width="100%" preload="" autoplay="" loop="" muted="" playsinline=""></video>
  877. </div>
  878. <div class="w-60-l">
  879. <p>You can achieve this by just dropping this data into a <code class="highlighter-rouge">&lt;span&gt;</code>, but the best practice nowadays is to use the <code class="highlighter-rouge">&lt;time&gt;</code> element. So you print things relatively like usual:</p>
  880. <div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;time&gt;</span>six minutes ago<span class="nt">&lt;/time&gt;</span>
  881. </code></pre></div> </div>
  882. <p>Then you add a human-friendly string to the <code class="highlighter-rouge">title</code> attribute:</p>
  883. <div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;time</span> <span class="na">title=</span><span class="s">"May 28, 2018, 3:47 PM PST"</span><span class="nt">&gt;</span>six minutes ago<span class="nt">&lt;/time&gt;</span>
  884. </code></pre></div> </div>
  885. <p>The last bit is that the <code class="highlighter-rouge">&lt;time&gt;</code> element also allows for a <code class="highlighter-rouge">datetime</code> attribute. This is a way to get past all your fancy relative formatting, or human formatting, and let clients parse out the <em>actual</em> timestamp correctly. If you’re wondering how you format this particular string, you haven’t been reading at all (and you’re going to miss all my good time puns, you heartless fiend, so go read it a <em>second</em> time).</p>
  886. <p>But yes: it’s our pal the friendly ISO 8601-formatted string. It’s everywhere!</p>
  887. <div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;time</span> <span class="na">title=</span><span class="s">"May 28, 2018, 3:47 PM PST"</span> <span class="na">datetime=</span><span class="s">"2018-05-28T15:47:57-08:00"</span><span class="nt">&gt;</span>six minutes ago<span class="nt">&lt;/time&gt;</span>
  888. </code></pre></div> </div>
  889. <p>If you ever print out a relative date or time to a page, you should follow this format everywhere. Extract it into a component or utility function or however it is your weirdo team does it, and you’ll make the most amount of people happy.</p>
  890. </div>
  891. <div class="w-60-l mt5">
  892. <h2 id="inputting-time">Inputting time</h2>
  893. <p>I don’t know if you’ve tried date pickers and time pickers over the years, but they’re awful.</p>
  894. <p><img src="/images/talks/utc/pickers.png" alt="Date pickers" /></p>
  895. <p>Maybe it’s just me, but I still haven’t found the perfect time and date picker yet. Either there’s accessibility problems, or design problems, or dependency and size problems, or something else entirely. This probably why there are so many of them: everyone says the same thing and tries to reinvent the wheel, thus perpetuating the cycle. I’m sure During will feel the need to create and open source our own at some point, too.</p>
  896. <p>Part of this stems from there not being a real, viable browser option. At a certain point browser makers realized this was a problem and got to work on adding <code class="highlighter-rouge">type=date</code> and <code class="highlighter-rouge">type=time</code> to the verable <code class="highlighter-rouge">&lt;input&gt;</code> element. And that sort of worked.</p>
  897. <p>Here’s <code class="highlighter-rouge">&lt;input type="date" /&gt;</code> in Chrome:</p>
  898. <video class="shadow-2 mv3" src="/video/utc-type=date.mp4" poster="/images/talks/utc/poster-type=date.jpg" width="100%" preload="" autoplay="" loop="" muted="" playsinline=""></video>
  899. <p>It… you know, works. Ugly as sin, though, and that’s the first problem: there aren’t enough hooks into the element to comprehensively style it as you’d like.</p>
  900. <p>Here’s <code class="highlighter-rouge">&lt;input type="time" /&gt;</code> in Chrome:</p>
  901. <video class="shadow-2 mv3" src="/video/utc-type=time.mp4" poster="/images/talks/utc/poster-type=time.jpg" width="100%" preload="" autoplay="" loop="" muted="" playsinline=""></video>
  902. <p>Also, here’s <code class="highlighter-rouge">&lt;input type="date" /&gt;</code> in Safari:</p>
  903. <video class="shadow-2 mv3" src="/video/utc-type=safari.mp4" poster="/images/talks/utc/poster-type=safari.jpg" width="100%" preload="" autoplay="" loop="" muted="" playsinline=""></video>
  904. <p>Safari, continuously behind on virtually every interesting standard on the planet these days, doesn’t support it at all. So yeah, everything is terrible.</p>
  905. <p>I asked someone far more knowledgeable than me on <code class="highlighter-rouge">&lt;input&gt;</code> about when we can finally start using a cross-platform, extensible, great option for date pickers. Her answer was an immediate <strong><em>oh god probably never</em></strong>. Neat! The web is great!</p>
  906. <p>So yeah, at the end of the day I’ve taken peace with trying to find the best crappy option, restyling it so it doesn’t look terrible, and then ignoring it and throwing my laptop into a lava flow. Just make peace with it.</p>
  907. </div>
  908. <div class="mt5 w-60-l">
  909. <h2 id="recurring-events">Recurring events</h2>
  910. <p>If someone held a gun to your head and demanded in the next week you either 1) programmed a comprehensive system that included full support for recurring events, or 2) invent full-scale ready-to-go-to-market cold fusion, then you should abolutely start brushing up on atomic physics. Recurring events is a true shit show.</p>
  911. <p>It starts normally enough, of course. You have an innocent phrase that you want to apply to your system, like:</p>
  912. <div class="ml5 fw5 f4">"Every Tuesday at 2pm"</div>
  913. <p>Awesome. So you start modeling it in your database. You say, hey, I’ll just create an event with a <code class="highlighter-rouge">starts_at</code> value of next Tuesday. And then you save another row for the Tuesday after that. And then another row for the Tuesday after that. And after that. And after that. You do this for 70 occurrences before you start realizing, hey, I think this goes to infinity. (Don’t ask me why it took you that long to figure this out; you’re the one who’s a little slow on the update. I figured it out by the 52nd occurrence.)</p>
  914. <p>Being that even AWS doesn’t have a hard drive with literal infinite space (yet), you realize you need to figure out another way to deal with this. Maybe you can just create a shorthand of rules that defines when things happen.</p>
  915. <p>Martin Fowler has a <a href="https://martinfowler.com/apsupp/recurring.pdf">really great whitepaper</a> on recurring events. It’s short, and walks you through figuring all this out in code-agnostic, plain English. (Definitely check it out if you get really excited about reading whitepapers. Also get yourself checked out if that’s actually the case.)</p>
  916. <p>Fowler called these shorthands <em>temporal expressions</em>. It’s a way of defining the problem space so your system can do something with it. And luckily, we have a standardized way of thinking about this, too, in <a href="https://tools.ietf.org/html/rfc5545">RFC 5545</a>. These are called <code class="highlighter-rouge">RRULEs</code>, or <strong>recurrence rules</strong>. So “Every Tuesday” might look like this:</p>
  917. <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>FREQ=WEEKLY;BYDAY=TU;INTERVAL=1
  918. </code></pre></div> </div>
  919. <p>By using something like this, you basically can get away with pre-generating only <em>one</em> event/instance/recurrence, and then in your client, or in-memory, or through some other approach, you generate these occurrences on-demand as you go.</p>
  920. <p>This might seem simple enough. And for very simple cases, yeah, it might not be too bad. But it’s all just a race against <em>time</em>. Because:</p>
  921. <ul>
  922. <li>What about Daylight Saving Time? If this is a time accessed by multiple users, whose particular brand of DST wins out? What happens if you observe DST but I don’t?</li>
  923. <li>What about exceptions? Maybe one of the Tuesdays is a holiday, so you don’t want to have an occurrence on that day.</li>
  924. <li>What about exceptions that are subsequently moved? Say Tuesday is a holiday, so we move it to Wednesday. Oops, no now we’ve moved it to Thursday. How do we efficiently model all that without going nuts?</li>
  925. </ul>
  926. <p>The erm… rules… in <code class="highlighter-rouge">RRULE</code> all handle this. There are rules like <code class="highlighter-rouge">EXDATE</code>, <code class="highlighter-rouge">EXRULE</code>, <code class="highlighter-rouge">UNTIL</code>, <code class="highlighter-rouge">DTEND</code>, <code class="highlighter-rouge">COUNT</code>, and many more. It’s an attempt to help model all of these extra problems you might run into… but at the expense of really cluttering up your domain logic.</p>
  927. <p>My advice for all of this is to go as simple and as inefficient as you can, at least initially. I guess that’s the opposite of what our usual goals are in software, but I think it’s good advice for time code. The more complex your time logic is, the more it picks up steam, like a snowball rolling down a cliff. Every little bit adds up and compounds.</p>
  928. <p>So try going simple at first, if you can. Instead of modeling a <code class="highlighter-rouge">RRULE</code> for a weekly reoccurrence, maybe you can just pre-generate all of the events ahead of time, but just for a year. Then on January 1, regenerate a new set of events in your database. This makes it 1) easy to reason about, 2) easy to query (it’s just a normal SQL query), and 3) gives you the benefit of having real database records backing each of your events (once you generate “virtual” events through <code class="highlighter-rouge">RRULEs</code>, it makes things like associations that much harder, since you don’t have a database ID to associate with).</p>
  929. </div>
  930. </div>
  931. <section class="mt6">
  932. <div class="center lh-copy dark-blue f3 white w-60-l pa3">
  933. <p class="ma0 f2"><span class="pink">Programming time</span> is pretty weird.</p>
  934. <p class="mv5">It can sometimes make you feel week in the knees, and very days and confused about how it all fits together. But watch it: this is hour burden to bear, and we can't just let it past us over.</p>
  935. <p class="mv5">
  936. We've been working on building <a href="http://during.com">During</a> for awhile now, and most of the time I've been tryna keep my sanity, but every now and then I take a step back and say wait a minute, how does any of this work? How does society work? Do users actually need all-day, floating, recurring events with exceptions spread over multiple Daylight Saving Time boundaries? Or should I just go tell users to eat one and go live a simpler life in the woods?
  937. </p>
  938. <p class="mv5">Anyway, what I mean is that I've been in time-headspace for awhile now. Here's a few last thoughts:</p>
  939. <p class="mv5"><span class="pink">Keep everything simple</span> as much as possible. Even if it means being really inefficient, or redundant, or ugly. Everything adds up, and I think usually programmers overthink time. (Leave overthinking for the times where it's actually critical to overthink.)</p>
  940. <p class="mv5"><span class="pink">Handle more in the client.</span> This is a little bit of an odd piece of advice, but especially when you have a central service (GraphQL, REST API, some central interface, particularly when hooked up with a single page app, mobile clients, or other clients), I think it's more important to have as simple a central service as possible. This means it should basically only speak UTC, and might not even handle a lot of the more complicated logic around recurring events, timezones, and so on. It adds redundancy in your clients, but I think it makes it easier to understand overall.</p>
  941. <p class="mv5"><span class="pink">Leverage standards</span> and let others do the heavy lifting. Obviously that means using the <em>Brightest Point in Human History</em>, also known as ISO 8601, but it also means using premade time libraries, resources like the Olson database, and leveraging other people's existing work as much as possible. Let someone else figure out the really gnarly edge cases so you can work on your domain's edge cases.</p>
  942. <p>Anyway, our time is up. ⌚️👀</p>
  943. <h2 class="mt6 db">Additional reading</h2>
  944. <p class="mv5">And finally, now that I've suckered you into caring this much about time, you might want to keep on reading. Here's some interesting links if all this text wasn't enough for you:</p>
  945. <ul class="list ml0 pl0 f5 links-list lh-copy">
  946. <li><a href="http://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time">Falsehoods Programmers Believe About Time</a> and its sequel, <a href="http://infiniteundo.com/post/25509354022/more-falsehoods-programmers-believe-about-time">More Falsehoods Programmers Believe About Time</a>. These get into some really nitty-gritty on programming time edge cases and weird things to keep in mind as you go. Lovely stuff, and if you haven't read them yet (or even if you haven't read them recently), you should go and give 'em a read now.</li>
  947. <li>There's a ton of amazing things to learn on the Wikipedia page for <a href="https://en.wikipedia.org/wiki/Unix_time">Unix time</a>. I started including some of these things here and there, but really you should just go through the whole thing. There's a lot of talk about Unix and how they deal and think about time. Some nice little nuggets in there, like why Unix epoch came before the standardization of UTC, and why the epoch is not exactly the number of seconds since 1970 (see: leap seconds).</li>
  948. <li>I don't know what my favorite George Carlin bit of all time is (okay, I do: it's <a href="https://www.youtube.com/watch?v=MvgN5gCuLac"><em>Stuff</em></a>), but <a href="https://www.youtube.com/watch?v=zaR3sVpTB98">this bit on time</a> is pretty great too. He had a way with words.</li>
  949. <li>From Hodinkee: <a href="https://www.hodinkee.com/articles/why-clocks-run-clockwise">Why do clocks run clockwise?</a> — I love stuff like this.</li>
  950. <li><a href="https://nylas.com/blog/rrules/">The deceptively complex world of calendar events and RRULEs</a>. Great post on breaking down how to think about RRULEs from a calendaring and system perspective.</li>
  951. <li>Wikipedia's <a href="https://en.wikipedia.org/wiki/Time_formatting_and_storage_bugs">Time formatting and storage bugs</a> is worth a look just for the sheer number of upcoming time-related bugs we know are coming. Y2K was just the start.</li>
  952. <li>The <a href="https://en.wikipedia.org/wiki/Happy_Monday_System">Happy Monday System</a>, which honestly I just loved based on the name of it alone. Shows how Japan has moved their holidays schedules around just to make people happier with a longer weekend.</li>
  953. <li>Time smearing links <a href="https://developers.google.com/time/">from Google</a> and <a href="https://aws.amazon.com/blogs/aws/keeping-time-with-amazon-time-sync-service/">from Amazon</a>. I didn't even get to cover time smearing, leap seconds, leap years, and all of the little ways we correct how we measure time. Leap seconds are a pretty interesting subject, particularly since they're nonstandard: the need to add another leap second can depend on if a lot of seismic activity happened recently, for example.</li>
  954. <li>Another plug for reading <a href="https://tools.ietf.org/html/rfc3339">RFC 3339</a>. It's very clearly written, not too long, and has a lot of examples like the aforementioned 1937 Netherlands example, as well as how they suggest displaying a leap second in an RFC 3339-formatted string, and the possibility of only emitting UTC time from a server as a security precaution. ("Others might consider this to be loss of useful functionality at the hands of paranoia.")</li>
  955. </ul>
  956. </div>
  957. </section>
  958. <div class="mt6 ph3 f4 bg-pink pa4">
  959. <div class="mv5 flex w-60-l center">
  960. <div class="flex-column tc" style="min-width: 120px">
  961. <img src="/images/holman.jpg" alt="Holman's avatar" class="br-100 shadow-0 b--white ba bw3" width="100" height="100" />
  962. </div>
  963. <div class="flex-column ml4 lh-copy">
  964. <div class="f3"><a href="/about">Zach Holman</a></div>
  965. <div class="mv4">I cofounded <a href="http://during.com">During</a>, a neat new calendar for people who <em>live</em> in their calendar.</div>
  966. <div class="mv4">I swear we're going to ship it soon, too.</div>
  967. <div class="mv4"><a href="https://twitter.com/holman">Follow me on Twitter</a> and I promise I won't waste your... <em>time</em>.</div>
  968. <div class="mv4 f6">I also promise that was the last pun.</div>
  969. <div class="mv4 f6">...until next time!</div>
  970. </div>
  971. </div>
  972. </div>
  973. </article>
  974. </section>
  975. <nav id="jumpto">
  976. <p>
  977. <a href="/david/blog/">Accueil du blog</a> |
  978. <a href="https://zachholman.com/talk/utc-is-enough-for-everyone-right">Source originale</a> |
  979. <a href="/david/stream/2019/">Accueil du flux</a>
  980. </p>
  981. </nav>
  982. <footer>
  983. <div>
  984. <img src="/static/david/david-larlet-avatar.jpg" loading="lazy" class="avatar" width="200" height="200">
  985. <p>
  986. Bonjour/Hi!
  987. Je suis <a href="/david/" title="Profil public">David&nbsp;Larlet</a>, je vis actuellement à Montréal et j’alimente cet espace depuis 15 ans. <br>
  988. Si tu as apprécié cette lecture, n’hésite pas à poursuivre ton exploration. Par exemple via les <a href="/david/blog/" title="Expériences bienveillantes">réflexions bimestrielles</a>, la <a href="/david/stream/2019/" title="Pensées (dés)articulées">veille hebdomadaire</a> ou en t’abonnant au <a href="/david/log/" title="S’abonner aux publications via RSS">flux RSS</a> (<a href="/david/blog/2019/flux-rss/" title="Tiens c’est quoi un flux RSS ?">so 2005</a>).
  989. </p>
  990. <p>
  991. Je m’intéresse à la place que je peux avoir dans ce monde. En tant qu’humain, en tant que membre d’une famille et en tant qu’associé d’une coopérative. De temps en temps, je fais aussi des <a href="https://github.com/davidbgk" title="Principalement sur Github mais aussi ailleurs">trucs techniques</a>. Et encore plus rarement, <a href="/david/talks/" title="En ce moment je laisse plutôt la place aux autres">j’en parle</a>.
  992. </p>
  993. <p>
  994. Voici quelques articles choisis :
  995. <a href="/david/blog/2019/faire-equipe/" title="Accéder à l’article complet">Faire équipe</a>,
  996. <a href="/david/blog/2018/bivouac-automnal/" title="Accéder à l’article complet">Bivouac automnal</a>,
  997. <a href="/david/blog/2018/commodite-effondrement/" title="Accéder à l’article complet">Commodité et effondrement</a>,
  998. <a href="/david/blog/2017/donnees-communs/" title="Accéder à l’article complet">Des données aux communs</a>,
  999. <a href="/david/blog/2016/accompagner-enfant/" title="Accéder à l’article complet">Accompagner un enfant</a>,
  1000. <a href="/david/blog/2016/senior-developer/" title="Accéder à l’article complet">Senior developer</a>,
  1001. <a href="/david/blog/2016/illusion-sociale/" title="Accéder à l’article complet">L’illusion sociale</a>,
  1002. <a href="/david/blog/2016/instantane-scopyleft/" title="Accéder à l’article complet">Instantané Scopyleft</a>,
  1003. <a href="/david/blog/2016/enseigner-web/" title="Accéder à l’article complet">Enseigner le Web</a>,
  1004. <a href="/david/blog/2016/simplicite-defaut/" title="Accéder à l’article complet">Simplicité par défaut</a>,
  1005. <a href="/david/blog/2016/minimalisme-esthetique/" title="Accéder à l’article complet">Minimalisme et esthétique</a>,
  1006. <a href="/david/blog/2014/un-web-omni-present/" title="Accéder à l’article complet">Un web omni-présent</a>,
  1007. <a href="/david/blog/2014/manifeste-developpeur/" title="Accéder à l’article complet">Manifeste de développeur</a>,
  1008. <a href="/david/blog/2013/confort-convivialite/" title="Accéder à l’article complet">Confort et convivialité</a>,
  1009. <a href="/david/blog/2013/testament-numerique/" title="Accéder à l’article complet">Testament numérique</a>,
  1010. et <a href="/david/blog/" title="Accéder aux archives">bien d’autres…</a>
  1011. </p>
  1012. <p>
  1013. On peut <a href="mailto:david%40larlet.fr" title="Envoyer un courriel">échanger par courriel</a>. Si éventuellement tu souhaites que l’on travaille ensemble, tu devrais commencer par consulter le <a href="http://larlet.com">profil dédié à mon activité professionnelle</a> et/ou contacter directement <a href="http://scopyleft.fr/">scopyleft</a>, la <abbr title="Société coopérative et participative">SCOP</abbr> dont je fais partie depuis six ans. Je recommande au préalable de lire <a href="/david/blog/2018/cout-site/" title="Attention ce qui va suivre peut vous choquer">combien coûte un site</a> et pourquoi je suis plutôt favorable à une <a href="/david/pro/devis/" title="Discutons-en !">non-demande de devis</a>.
  1014. </p>
  1015. <p>
  1016. Je ne traque pas ta navigation mais mon
  1017. <abbr title="Alwaysdata, 62 rue Tiquetonne 75002 Paris, +33.184162340">hébergeur</abbr>
  1018. conserve des logs d’accès.
  1019. </p>
  1020. </div>
  1021. </footer>
  1022. <script type="text/javascript">
  1023. ;(_ => {
  1024. const jumper = document.getElementById('jumper')
  1025. jumper.addEventListener('click', e => {
  1026. e.preventDefault()
  1027. const anchor = e.target.getAttribute('href')
  1028. const targetEl = document.getElementById(anchor.substring(1))
  1029. targetEl.scrollIntoView({behavior: 'smooth'})
  1030. })
  1031. })()
  1032. </script>