<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">On Tue, Jan 21, 2020 at 3:57 PM Roger Lipscombe <<a href="mailto:roger@differentpla.net">roger@differentpla.net</a>> wrote:</span><br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Unless your timestamps are *intended* to be in user's local time. This<br>
is a problem with (e.g.) remote management/deployment solutions: the<br>
user actually *wants* their OS upgrade to be scheduled in their<br>
timezone, according to the daylight saving rules for then, not now.<br>
</blockquote></div><br clear="all"><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">That is a separate problem in my book.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Your system will have an internal representation, which you should treat as abstract/unknown. And there is an external representation which you use to enter and extract points-in-time. If you want an OS upgrade to happen at 02:00am ET, you then provide that to your marshal function, and it converts that to your internal representation. If you want this point-in-time in, say, CET, you then extract it from the internal representation into a string where CET is the timezone.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">You can choose any internal representation and reference. {Mega, Secs, Micro}, nanoseconds, gregorian basepoint, 1/1 1970 basepoint, floating point, a record, ... as long as you can marhsal/unmarshal.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">However, there are some internal representations which are going to be easier to work with. UNIX uses seconds after 1/1 1970, and keeping that at UTC makes things a tad easier as well in the long run. Consider if the machine roams. Now you can do:</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">$ TZ='EST' /bin/date<br>Tue 21 Jan 2020 10:32:40 AM EST<br>$ TZ='CET' /bin/date<br>Tue 21 Jan 2020 04:32:57 PM CET<br></div><br></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">This is also useful if multiple people are using the machine, but from different time zones. It is the same internal representation, but our presentation changes and switches based on where we are located. If you make the choice your internal representation moves with the timezone, and you have a roaming system, then you have to rewrite all timestamps on timezone changes. Or you have to keep a non-UTC timezone as the base, but this is not common. Non-UTC timezones are also a hassle if you ever need to combine log files from multiple data center locations each running with their own timezone.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">My experience is that it is often easier to do this conversion in the border of your system and then work with a UTC-reference internally. Otherwise, you end up with the need to do conversions on demand in your code. This is certainly doable in languages with type systems, as the type system can protect you against incorrect use. But in a uni-typed world where everything is a term, you usually want a simple representation.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"></div><br></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature">J.</div></div>