medley icon indicating copy to clipboard operation
medley copied to clipboard

Do we have the right daylight savings days?

Open rmkaplan opened this issue 3 years ago • 22 comments

\UNPACKDATE seems to return an hour that is one less than our current DST clock time. But its return value-component to say that it is DST is NIL, at least today. If you give it a date from a week or so ago, it gets it right, or a week have Novermber 7.

I think it doesn't have the right settings for the begin/end of DST. Constants in IOCHAR?

rmkaplan avatar Oct 24 '21 22:10 rmkaplan

Almost certainly the wrong DST days. We used to update them in the PARC-INIT but I don't think they got updated in the system sources.

nbriggs avatar Oct 24 '21 22:10 nbriggs

DST adjustments are location dependent as are time zones. And date-times in the past are often wacky with regard to a recorded local time being DST or not.

Can you rely on the host operating system for this, using UTC in interchange and as the internal reference date-time?

E.g., this year the EU (and UK) go off DST at their 1 am October 31, when it starts locally in some regions of Australia :). The US goes off DST in the early hours of November 7.

(Observation made in ignorance of how \UNPACKDATE is expected to work.)

orcmid avatar Oct 24 '21 23:10 orcmid

look at https://github.com/Interlisp/maiko/blob/master/src/timer.c and

  grep -lri "time.*zone" maiko

on the inside story. I thought I saw a subr or something to get the UNIX timezone.

there are files that have embedded dates in "FILECREATED" expressions and are off systematically. But it could be someone was running with their clock set wrong.

i don't see the need to solve this. Yes, Interlisp dates don't have timezones. Is there a problem? Interlisp doesn't rely on file dates so much.

I don't remember understanding why secure systems need accurate clocks

masinter avatar Oct 25 '21 02:10 masinter

@masinter

I don't remember understanding why secure systems need accurate clocks

https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/maximum-tolerance-for-computer-clock-synchronization

Addendum: There are also timestamp services that I presume require some level of time synchronization. These are used as adjuncts to digital signatures, attesting to the verification of the signature at the time indicated and useful when the signature cert expires or is revoked later. It can be taken as an affirmation that the the signature was "good" at the time. This is recommended for code signing. Might be relevant for docker images related to this project :).

orcmid avatar Oct 25 '21 02:10 orcmid

I think (DATE) is off by an hour right now. Shouldn’t we at least try to be accurate?

On Oct 24, 2021, at 7:36 PM, Larry Masinter @.***> wrote:

look at https://github.com/Interlisp/maiko/blob/master/src/timer.c https://github.com/Interlisp/maiko/blob/master/src/timer.c and

grep -lri "time.*zone" maiko on the inside story. I thought I saw a subr or something to get the UNIX timezone.

there are files that have embedded dates in "FILECREATED" expressions and are off systematically. But it could be someone was running with their clock set wrong.

i don't see the need to solve this. Yes, Interlisp dates don't have timezones. Is there a problem? Interlisp doesn't rely on file dates so much.

I don't remember understanding why secure systems need accurate clocks

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/544#issuecomment-950474846, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQSTUJJKQG6T6MFU3CDATXTUIS7C3ANCNFSM5GT5RTLQ.

rmkaplan avatar Oct 25 '21 04:10 rmkaplan

Set \EndDST to 1 more than it is currently and it will get at least today's time correct.

On Oct 24, 2021, at 9:22 PM, rmkaplan @.***> wrote:

I think (DATE) is off by an hour right now. Shouldn’t we at least try to be accurate?

On Oct 24, 2021, at 7:36 PM, Larry Masinter @.***> wrote:

look at https://github.com/Interlisp/maiko/blob/master/src/timer.c https://github.com/Interlisp/maiko/blob/master/src/timer.c and

grep -lri "time.*zone" maiko on the inside story. I thought I saw a subr or something to get the UNIX timezone.

there are files that have embedded dates in "FILECREATED" expressions and are off systematically. But it could be someone was running with their clock set wrong.

i don't see the need to solve this. Yes, Interlisp dates don't have timezones. Is there a problem? Interlisp doesn't rely on file dates so much.

I don't remember understanding why secure systems need accurate clocks

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/544#issuecomment-950474846, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQSTUJJKQG6T6MFU3CDATXTUIS7C3ANCNFSM5GT5RTLQ.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/544#issuecomment-950514410, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6DAWLR6PW2PICDCXWNNE3UITLORANCNFSM5GT5RTLQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

nbriggs avatar Oct 25 '21 04:10 nbriggs

Documentation (as of 1985) says

\BeginDST is the day of the year on or before which Daylight Savings Time takes effect (i.e., the Sunday on or immediately preceding this day); \EndDST is the day on or before which Daylight Savings Time ends. Days are numbered with 1 being January 1, and counting the days as for a leap year. In the USA where Daylight Savings Time is observed, \BeginDST = 121 and \EndDST =305. In a region where Daylight Savings Time is not observed at all, set \BeginDST to 367.

The current US situation, for those states that observe DST, is that it starts on or before March 14, day 74 in a leap year and it ends on or before November 7, day 312 in a leap year. They're currently set to 98 and 304.

nbriggs avatar Oct 25 '21 05:10 nbriggs

The variable \EndDST is indeed set to 304 (today is day 297). So must be controlled by something else.

On Oct 24, 2021, at 10:13 PM, Nick Briggs @.***> wrote:

Documentation (as of 1985) says

\BeginDST is the day of the year on or before which Daylight Savings Time takes effect (i.e., the Sunday on or immediately preceding this day); \EndDST is the day on or before which Daylight Savings Time ends. Days are numbered with 1 being January 1, and counting the days as for a leap year. In the USA where Daylight Savings Time is observed, \BeginDST = 121 and \EndDST =305. In a region where Daylight Savings Time is not observed at all, set \BeginDST to 367.

The current US situation, for those states that observe DST, is that it starts on or before March 14, day 74 in a leap year and it ends on or before November 7, day 312 in a leap year. They're currently set to 98 and 304.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/544#issuecomment-950534140, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQSTUJKDDXSQDV2XV4TMYRLUITROLANCNFSM5GT5RTLQ.

rmkaplan avatar Oct 25 '21 05:10 rmkaplan

304 is incorrect, set it to 312.

nbriggs avatar Oct 25 '21 06:10 nbriggs

Documentation (as of 1985) says ... The current US situation, for those states that observe DST, is that it starts on or before March 14, day 74 in a leap year and it ends on or before November 7, day 312 in a leap year. They're currently set to 98 and 304.

I suppose Interlisp can be forgiven for not reflecting the US changes that went into effect for the first time in 2007. https://en.wikipedia.org/wiki/Daylight_saving_time_in_the_United_States

Is this being discussed relative to where an instance of Interlisp is running or what?

orcmid avatar Oct 25 '21 15:10 orcmid

@orcmid -- Ron is here in the US, and the DST defaults in Interlisp have always been set for the US, but they're set up in global variables not constants so they're easy to modify. The algorithm that takes them as input to determine if it's DST or not (and tries in a sort of half-hearted way to come up with a time zone name) is also US-centric, but again, if it's wrong then one can replace the code in one's site (or personal) init file.

Of course Interlisp could set the DST and time zone from the underlying host, but what does that mean in a world where I'm running an instance in the cloud and the host is not in "my" time zone or even my country?

nbriggs avatar Oct 25 '21 16:10 nbriggs

@nbriggs

Of course Interlisp could set the DST and time zone from the underlying host, but what does that mean in a world where I'm running an instance in the cloud and the host is not in "my" time zone or even my country?

That's not a new problem. Remote hosting also adds a time-of-day consideration. I suspect ground truth is where the instance is running, maybe normalized to UTC (so it is easy to adjust for different remote-access offsets when there is sufficient information). Whether this problem (needs to)/can be solved beyond that for Interlisp is maybe out of scope.

orcmid avatar Oct 25 '21 17:10 orcmid

@orcmid Agreed. There are no deep philosophical issues that we're addressing here. Ron has fixed the default DST days for USA 2021 and forward. Anyone who wants a different presentation can trivially set different values in their personal customization file.

nbriggs avatar Oct 25 '21 20:10 nbriggs

But a side note: the variables for begin and end are slashed (\BeginDST, \EndDST), which suggests that users should not set them. Maybe that should be changed and these should be more public.

On Oct 25, 2021, at 1:38 PM, Nick Briggs @.***> wrote:

@orcmid https://github.com/orcmid Agreed. There are no deep philosophical issues that we're addressing here. Ron has fixed the default DST days for USA 2021 and forward. Anyone who wants a different presentation can trivially set different values in their personal customization file.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/544#issuecomment-951309669, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQSTUJPAA3CXXNE3L6XOET3UIW55TANCNFSM5GT5RTLQ.

rmkaplan avatar Oct 25 '21 20:10 rmkaplan

I read \ as... don't set this unless you know what you're doing. In this case that's because they are NOT the first and last day number of DST for this year, they're the first and last day, in LEAP YEAR numbering of the last Sunday on before which the time changes. Given that they're documented in the IRM since forever, I wouldn't change them.

nbriggs avatar Oct 25 '21 21:10 nbriggs

image

masinter avatar Oct 25 '21 23:10 masinter

Yeah, it's the time and basic timezone but not the daylight saving time period which doesn't come through that interface.

nbriggs avatar Oct 25 '21 23:10 nbriggs

Right, it's \NS.SETTIME (whose definition is clobbered by MAIKO) image that gets the time zone from the XNS time service. Is there no equivalent SUBRCALL?

masinter avatar Oct 26 '21 01:10 masinter

TCP/IP NTP time protocol does not deal with time zones or DST at all, it just establishes time in seconds (and fraction) from 1970. In the Linux runtime code, there is a fairly large (and probably messy) table that isn't just the days it changes now, but for all years so that the time format transformation calls do the right thing for past dates too. This means there are updates to the Linux code tree that get pushed out every time the DST laws change somewhere. Conversions in time format are handled in the C libraries. I think it would be possible to write code that could deduce the magic numbers. I don't think the Interlisp user base will be large enough anytime soon to be worth doing the "right thing".

D-Van-Buer avatar Sep 11 '22 03:09 D-Van-Buer

Yeah, absolutely, which is why the values are trivially settable by anyone who wants to put them in a site or personal init file, without recompilation or anything magic… ;-)

nbriggs avatar Sep 11 '22 04:09 nbriggs

Belongs in the FAQ and intro to running Medley... especially a problem for online users since the user could be coming from anywhere. There are filedate problems for FILECREATED dates because DATE and IDATE don't do anything with TimeZone info .

masinter avatar Sep 11 '22 05:09 masinter

It's probably safe to use a universal time (whether seconds from an origin), as long as the origin timezone is understood. I assume that is UTC in modern systems. Some operating systems don't handle that with regard to showing local time properly and/or stamping local files properly. With regard to persistent dates of a "now" somewhere, it should be "now" where the date is affixed. If that is always UTC, then it is easy for an observer to convert to their relevant local time. That seems to work on email that I receive from international origins.

I think it is amazing that Linux handles retrospective daylight rules. It is annoying for me that my Outlook Calendar makes a mess of it when I look back at older entries.

With regard to Interlisp adoption, look at it this way. The user base can't get internationally (or even nationally) larger if this is not handled. And whatever course is taken, it must be sensible to some degree of sensibility.

As I type this, there are 43,457 of over a million users active in the Second Life virtual world. The local "SL Time" is 9:39 AM. That happens to be USA California local time and everyone copes with that. All in-game times are recorded in SL Time, including on timestamps of messages. I don't mind. I live in the same time zone :). The fixed, predictable nature of SL Time is something all can deal with, including the contrary (to the Southern Hemisphere) or offset differences in daylight times, where those occur.

And I adjust my head around the time of distant connections the same as I would in arranging or participating in conference calls and web casts, the last two being in Haifa and in Melbourne, respectively.

orcmid avatar Sep 11 '22 16:09 orcmid