TIP: Click on subject to list as thread! ANSI
echo: 4dos
to: LEONARD ERICKSON
from: JOHN HENTSCH
date: 1998-05-01 07:46:00
subject: Daylight savings time

In a message to John Hentsch  Leonard Erickson wrote:
LE> That's bad enough. Worse is the problem of keeping the adjustment from
LE> happening more than once on the given date.
The way I I'm planning on handling it is to simply set the
environmental variable UTC+7 or UTC+8 depending on a date range.
An InterNet time server will take care of the rest.
The logic would be something like:
set GTZ=UTC+8
IF it is between the start of DST and the end of DST then SET GTZ=UTC+7
:: *******************************************************************
:setGTZ
set GTZ=UTC+8
:: Daylight savings time is assumed to last from 2:00am April 07 until
:: 2:00am October 27. In a leap year, April 07 is day 98 and October 27
:: is day 301.
iff $@eval[%_year %% 4] == 0 then
  :: Leap year -
  set day1=98
  set day2=301
else
  set day1=97
  set day2=300
endiff
:: Adjust if daylight savings time -
iff (%_doy) gt (%day1) .and. (%_doy) lt (%day2) then
  set GTZ=UTC+7
elseiff (%_doy) == (%day1) .and. (%_hour) ge (2) then
  set GTZ=UTC+7
elseiff (%_doy) == (%day2) .and. (%_hour) lt (2) then
  set GTZ=UTC+7
endiff
set day1=
set day2=
return
:: *******************************************************************
OR
:: ********************************************************************
:setGTZ
set GTZ=UTC+8
OR:
:: *******************************************************************
set GTZ=UTC+8
:: Daylight savings time is assumed to last from 2:00am April 07 until
:: 2:00am October 27.
:: When in daylight savings time, subtract one hour -
iff $@eval[%_year %% 4] == 0 then
  :: In a leap year, April 07 is day 98 and October 27 is day 301.
  if %_doy gt 98  .and. %_doy  lt 301 set GTZ=UTC+7
  if %_doy == 98  .and. %_hour ge 2   set GTZ=UTC+7
  if %_doy == 301 .and. %_hour lt 2   set GTZ=UTC+7
else
  :: In a non-leap year, April 07 is day 97 and October 27 is day 300.
  if %_doy gt 97  .and. %_doy  lt 300 set GTZ=UTC+7
  if %_doy == 97  .and. %_hour ge 2   set GTZ=UTC+7
  if %_doy == 300 .and. %_hour lt 2   set GTZ=UTC+7
endiff
return
:: *******************************************************************
jh -
--- ViaMAIL!/WC4 v1.40j
---------------
* Origin: Mail Box BBS Glendora, CA USA (1:218/907)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.