 Subj : Daylight Savings                                                        


MJ>set month=%@substr[%_date,0,2]
  >if %month LT 4 .OR. %month GT 10 set daylight=0
  >if %month GT 4 .AND. %month LT 10 set daylight=1
  >iff "%daylight" != "" then^unset month^quit^endiff

Huh? At first look, because the first two tests are mutually
exclusive, this should be marginally faster:

iff %month LT 4 .OR. %month GT 10 then set daylight=0
elseiff %month GT 4 .AND. %month LT 10 then set daylight=1
endiff
if "%daylight" != "" (unset month^quit)

Why use UNSET, when SETLOCAL is available? Because you're afraid of
losing the result in %daylight? You can fix that by changing all your
QUITs to the following

quit %daylight

If you're willing to put up with multiple return points--generally
inadvisable in structured programming, but oh so handy here--you can
simplify greatly, dealing with the easy cases first.

if %month lt 4 .or. %month gt 10 then quit 0
if %month gt 4 .and. %month lt 10 then quit 1
:

But for speed, nothing beats a lookup table:

::@(#)Returns 1 if daylight savings is in effect today
::Maynard Hogg, 11/14/91
::
setlocal
set month=%@substr[0000200000300,%@substr[%_date,0,2],1]
::Note month "0"---^   ^Apr  ^Oct
if %month le 1 quit %month
::next Sunday?
::Can't use previous Sunday since 4DOS treats negative
::numbers in comparisons as strings in comparisons!
set sun=%@eval[%@substr[%_date,3,2]- \
  %@index[SunMonTueWedThuFriSat,%_dow]/3 + 7]
iff %month == 2 then
 echo April
 if %sun ge 8 quit 1
 quit 0
elseiff %month == 3 then
 echo October
 if %sun ge 32 quit 0
 quit 1
else then
 echo Shouldn't reach here!
 quit 255
endiff

