Kind of puzzled about timestamps

Bruce Labitt bruce.labitt at myfairpoint.net
Thu Mar 4 22:32:03 EST 2021


On 3/4/21 9:56 PM, Joshua Judson Rosen wrote:
> On 3/4/21 7:13 PM, Bruce Labitt wrote:
>> Good point.  I'll check that.  Logging machine was set to local time EST.  But it does have a wireless link, maybe it set itself internally to UT.  Thanks for the hint.
> You have your code explicitly calling a function named `UTC from timestamp'.
>
> If you want localtime and not UTC, call the function that doesn't start with "utc".
>
> And if you want to assume some particular timezone other than your system's default,
> you can pass that as an optional argument.
>
> BTW, FYI "UT" is *not* the same thing as "UTC". Timezones are confusing enough,
> it's worth spending the extra character to avoid creating even more confusion
> (or just call it "Z" and save yourself even more characters).
>
> And as a general word of advice from someone whose been burnt way too many times:
> if you're going to put timestamps in your filenames, either just use UTC
> or explicitly indicate which timezone the timestamps are assuming.
>
> "the local non-UTC timezone" *changes*. Frequently. Like, twice every year if you're lucky--
> and more frequently than that if you're unlucky. And if you are, for example, generating those
> files/filenames between 1:00 AM and 2:00 AM when you go from EDT to EST in November
> (and that "1:00-2:00 localtime" interval *repeats*)..., you'll be sorry.
>
These files are written by commercial closed box machines (medical 
equipment).  There is no choice for the users.  That being said, these 
machines are designed to basically have the time set once.  (Drift, ntp? 
what's that?)  If one plays with resetting the time, one can be rewarded 
by having all your data wiped.

"UT" was me being lazy.  (Too lazy to type the extra character...)  I 
don't have any code with explicit timezone stuff in it.  Have to agree 
it's a good idea to keep time in UTC, to avoid 'many' of the headaches.  
Nonetheless, it's easy to get confused about all this, especially if 
external devices don't do time the same way.  (Not all devices handle 
time correctly.) Then, as you say, you'll be sorry.



More information about the gnhlug-discuss mailing list