TIP: Click on subject to list as thread! ANSI
echo: 4dos
to: JOHN HENTSCH
from: TED MENKS
date: 1998-05-13 12:55:00
subject: Daylight savings time

Hi John,
(Tuesday May 12 1998 12:40) John Hentsch to Ted Menks about: Daylight savings 
time
 JH> 4DOS is at v6.01a on the CD.
Well, then I guess it's ok for me to use the newest possible functions and/or 
features where applicable 
I've done as much as I could in the short time that has passed, and succeeded 
in shortening your routine by almost 30% (1318 bytes vs. your 1865 bytes !)
I've discarded three temporary variables, making the thing work with less 
environment space. In addition I've found one or two locations where you used 
the wrong value for GTZ...
Except for these minor corrections it should, effectively, still be fully 
compatible with your version, although it may run a tiny bit faster ;-)
In case you'd like to try it out, and eventually replace your program with it 
completely, here comes nothing :)
:: **************************************************************************
:setGTZ
:: Check for day light savings time date/time range -
set tStr=%@eval[8-%@dowi[4-7-%_year]]
set daytmdate=%@doy[4-%tStr-%_year]
gosub setGTZ1
echo Daylight Time JumpForward Date: Sunday, April %tStr, %_year.
set tStr=%@eval[32-%@dowi[10-31-%_year]]
set stdtmdate=%@doy[10-%tStr-%_year]
gosub setGTZ1
echo Standard Time FallBack Date:    Sunday, October %tStr, %_year.
echo.
set GTZ=UTC+7
set toDay=%@doy[%_date]
iff %toDay gt %daytmdate .and. %toDay lt %stdtmdate then
  echo ...It's Daylight Savings time!
elseiff %toDay eq %daytmdate then
  iff %@time[%_time] lt %@time[02:00:00] then
    echo ...It's still Standard Time!
    set GTZ=UTC+8
  else
    echo Today is the first day of Daylight Savings Time!
  endiff
elseiff %toDay eq %stdtmdate then
  iff %@time[%_time] lt %@time[02:00:00] then
    echo ...It's still Daylight Savings time!
  else
    echo Today is the first day of Standard Time!
    set GTZ=UTC+8
  endiff
else
  echo ...It's Standard Time!
  set GTZ=UTC+8
endiff
echo.
unset toDay Daytmdate Stdtmdate tStr
return
:setGTZ1
iff %@index[ 1 2 3 , %@instr[0,-1,0%tStr]] eq -1 then
  set tStr=%tStr%th
elseiff %@instr[1,-1,0%tStr] eq 1 then
  set tStr=%tStr%th
else
  set tStr=%tStr%%@word[%@instr[0,-1,0%tStr],nul st nd rd]
endiff
return
:: **************************************************************************
I sincerely hope you like the result of my effort.
Random greetings,
  Ted Menks  2:2449/236.51 / 2:284/412.51  PGPkey: 2048/1B2ACCED (by RRQ)
... If at first you don't succeed, have somebody else do it for you!
--- 4Dos v6.01a ---
(2:2449/236.51)
---------------
* Origin: It's the 4Dos way! (Teddy's Land +49-5971-14966

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™.