Re: How does Linux handle DST/ST? It's all about time...

2020-11-10 Thread Bill Ricker
On Tue, Nov 10, 2020 at 2:15 PM Bruce Labitt 
wrote:

> "Dumb" machine, while actually computer controlled, is closed source.
> No possibility of changing its behavior.
> No ssh, no network.  It's a data logger to an SD card.  I have to use
> sneaker net to transport data to my PC.
>
> Other possibility (after a SD card backup) is to change the dumb machine
> clock back to standard time, hopefully without messing any settings up.
>

Dumb machines that don't understand timezones properly should probably be
set to Zulu=UTC as their timezone.
(Which is the internal time for most Linux systems' RTC also, TZ are just
user interface things there.)

(This solves the problem of having the same times twice when falling back;
there's no change.)

My Garmin GPS claims to understand TZ (for display) but records posits as
Z=UTC.

Alas that just makes things worse for reading the SD card, as that's always
4-5 hours ahead, unless the TZ is included in the timestamp on the SD card
(but not indication of DST/ST)?
___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/


Re: How does Linux handle DST/ST? It's all about time...

2020-11-10 Thread Michael ODonnell



If some variation of that sleazy hack doesn't work and you can't
find some some source for the info you want (maybe something like
https://isDSTactiveInMyTimezone.com/ :) then you'll have to determine
if DST is active on your own.

That requires a timezone file for your locale and some source of "current
UTC time"; your system clock chip can presumably supply the latter.

Here's hoping you can find existing code (like a Python library) to
paddle around in timezone files.

If not, you can dump a timezone file with zdump; the output shows (among
other things) the exact dates/times of transitions into and out of DST,
as well as your locale's offset from UTC after each transition.

The timezone files typically live in /usr/{share,lib}/zoneinfo/

The timezone file governing your system is specified in /etc/timezone

So, on my Ubuntu system this command dumps the current timezone file:

   zdump -v /usr/share/zoneinfo/$(cat /etc/timezone)

...in a text format that could be parsed to discover if DST is in effect
in my timezone.  Ick.

___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/


Re: How does Linux handle DST/ST? It's all about time...

2020-11-10 Thread Bruce Labitt
"Dumb" machine, while actually computer controlled, is closed source.  
No possibility of changing its behavior.
No ssh, no network.  It's a data logger to an SD card.  I have to use 
sneaker net to transport data to my PC.

Other possibility (after a SD card backup) is to change the dumb machine 
clock back to standard time, hopefully without messing any settings up.  
Fortunately I have recorded all the necessary settings.  The dumb 
machine has big warnings to not do such a thing as the instructions warn 
of data corruption.

Probably will end up just changing the dumb clock.  There does seem to 
be a struct with an int called tt_isdst, which should be useful, 
however, not sure the solution would be platform independent.  As I 
understand it, linux uses UTC in the RT clock and Windows uses 
localtime.  How messy.  Oh well, so much for a sw solution, going to 
change the time on dumbo.

Back to what you all were doing... Sorry for the noise.


On 11/10/20 1:23 PM, Michael ODonnell wrote:
>
> You can mess around with DST and such but this slightly sleazy hack
> might serve an alternative: find some way to get your "dumb" machine to
> tell your "smart" machine what time it thinks it is currently, and then
> force the smart machine to that time.  For example, if SSH works from
> the smart machine to the dumb one then from the smart one you might say:
>
>   % x="$(ssh dumb date)"
>   % sudo date --set="$x"
>
> ...or some variation on that theme.
>
>--M
>
> ___
> gnhlug-discuss mailing list
> gnhlug-discuss@mail.gnhlug.org
> http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/
>

___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/


Re: How does Linux handle DST/ST? It's all about time...

2020-11-10 Thread Jerry Feldman
The basic Unix time was to set up an epoch based on UTC time. This way when
systems talk to each other they are on the same time basis. So, each
machine needs to know what offset from utc, and whether or not it is on std
or daylight time.

--
Jerry Feldman 
Boston Linux and Unix http://www.blu.org
PGP key id: 6F6BB6E7
PGP Key fingerprint: 0EDC 2FF5 53A6 8EED 84D1  3050 5715 B88D 6F6
B B6E7

On Tue, Nov 10, 2020, 1:24 PM Michael ODonnell 
wrote:

>
>
> You can mess around with DST and such but this slightly sleazy hack
> might serve an alternative: find some way to get your "dumb" machine to
> tell your "smart" machine what time it thinks it is currently, and then
> force the smart machine to that time.  For example, if SSH works from
> the smart machine to the dumb one then from the smart one you might say:
>
>  % x="$(ssh dumb date)"
>  % sudo date --set="$x"
>
> ...or some variation on that theme.
>
>   --M
>
> ___
> gnhlug-discuss mailing list
> gnhlug-discuss@mail.gnhlug.org
> http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/
>
___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/


Re: How does Linux handle DST/ST? It's all about time...

2020-11-10 Thread Michael ODonnell



You can mess around with DST and such but this slightly sleazy hack
might serve an alternative: find some way to get your "dumb" machine to
tell your "smart" machine what time it thinks it is currently, and then
force the smart machine to that time.  For example, if SSH works from
the smart machine to the dumb one then from the smart one you might say:

 % x="$(ssh dumb date)"
 % sudo date --set="$x"

...or some variation on that theme.

  --M

___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/


How does Linux handle DST/ST? It's all about time...

2020-11-10 Thread Bruce Labitt
Still looking at a time related bug.  Wondering how (nowadays) linux 
handles TZ and DST/ST transition.

Does linux embed DST state into TZ?  Or is there a variable with a name 
like "DST"?

I want to set two different machines, one a PC, the other a dumb 
instrument to the same time.  The dumb one doesn't do time adjustment.  
My PC, obviously does.

I want to create a time, on my PC called: mytime = utc + utc_offset.  If 
utc_offset is invariant, then I am all set.  All I can see is (at least 
for ubuntu) there is TZ, which appears to be equal to utc_offset + DST*1.

If there was a variable called DST, I'd be done.  Then mytime = utc + 
utc_offset -DST*1, where DST=1 if now is daylight savings time, or DST=0 
if now is standard time.

Anyone have insight on this?  All I know is that my dumb machine was set 
to DST last month.  My PC is DST corrected.  Half the time, (all during 
ST) the device clock is ahead of the PC clock. Why is this bad - because 
the PC refuses to read files timestamped in the future.  I do not want 
to correct the dumb machine's clock twice a year, as there is documented 
potential for destroying data.  This should be correctable on the PC 
end, shouldn't it?

___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/