<story><title>Storing UTC is not a silver bullet</title><url>https://codeblog.jonskeet.uk/2019/03/27/storing-utc-is-not-a-silver-bullet/</url></story><parent_chain><item><author>rlpb</author><text>This is the same as the alarm clock problem. When a user creates an event, what does that user _mean_? In the alarm clock example, what should happen if I&amp;#x27;ve set my alarm clock 7am and then travel to a different time zone? In the conference event example, what should happen if the local time zone rules change, or daylight savings time comes into force? Did the event organiser print marketing materials that said &amp;quot;starts at 1000 UTC&amp;quot; or &amp;quot;starts at 10am&amp;quot; with a &amp;quot;in the local time zone&amp;quot; implication?&lt;p&gt;Events generally need to be locked to _something_ - whether that is UTC or a local time zone depends on the application.&lt;p&gt;The iCalendar standard (&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;tools.ietf.org&amp;#x2F;html&amp;#x2F;rfc5545&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;tools.ietf.org&amp;#x2F;html&amp;#x2F;rfc5545&lt;/a&gt;) generally gets this right.</text></item></parent_chain><comment><author>bshipp</author><text>In situations with ambiguity like this, it&amp;#x27;s probably best to ask the user instead of make assumptions.&lt;p&gt;I would not be remotely perturbed if my phone had a pop up when I stepped off the plane asking me if I still wanted to wake up at 7AM local or would prefer to wake up at 10AM UTC.&lt;p&gt;I would be greatly perturbed if it assumed the latter and I missed my meeting, all because I forgot to set a timezone when I originally inserted it a month prior.</text></comment>
<story><title>Storing UTC is not a silver bullet</title><url>https://codeblog.jonskeet.uk/2019/03/27/storing-utc-is-not-a-silver-bullet/</url></story><parent_chain><item><author>rlpb</author><text>This is the same as the alarm clock problem. When a user creates an event, what does that user _mean_? In the alarm clock example, what should happen if I&amp;#x27;ve set my alarm clock 7am and then travel to a different time zone? In the conference event example, what should happen if the local time zone rules change, or daylight savings time comes into force? Did the event organiser print marketing materials that said &amp;quot;starts at 1000 UTC&amp;quot; or &amp;quot;starts at 10am&amp;quot; with a &amp;quot;in the local time zone&amp;quot; implication?&lt;p&gt;Events generally need to be locked to _something_ - whether that is UTC or a local time zone depends on the application.&lt;p&gt;The iCalendar standard (&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;tools.ietf.org&amp;#x2F;html&amp;#x2F;rfc5545&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;tools.ietf.org&amp;#x2F;html&amp;#x2F;rfc5545&lt;/a&gt;) generally gets this right.</text></item></parent_chain><comment><author>BillinghamJ</author><text>For ref, this is the relevant bit: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;tools.ietf.org&amp;#x2F;html&amp;#x2F;rfc5545#section-3.3.5&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;tools.ietf.org&amp;#x2F;html&amp;#x2F;rfc5545#section-3.3.5&lt;/a&gt;&lt;p&gt;This is something we (startup insurance company) have thought about a lot actually. Since the certificates we issue are relevant to a particular jurisdiction, if the document states e.g. &amp;quot;23:59:59&amp;quot;, it means the &amp;quot;wall clock&amp;quot; time in that jurisdiction - whatever point-in-time our DB contains isn&amp;#x27;t really that relevant.&lt;p&gt;So the likely problematic situ is if we&amp;#x27;ve got a policy end date&amp;#x2F;time more than a year in advance, then the country changes their TZ offsets, we need to make sure our point-in-time records get updated (and then of course the duration of the policy changes). It&amp;#x27;s a bit of a pain in a system built around immutable events!&lt;p&gt;On a kinda related note, we also took the decision to clearly define that our start&amp;#x2F;end date-times have a resolution of one second and are inclusive. So if a policy starts at 00:00:00 and ends at 23:59:59, that&amp;#x27;s the full day, all the way up to midnight. It also means then it&amp;#x27;s important that we render the full time (incl seconds) on our docs.</text></comment>