Hello John,
In a message dated Apr 28 at 21:28, John Hentsch of 1:218/907
wrote to All:
JH> Before I set out and try to figure it out myself, I was wondering
JH> if someone already wrote a 4DOS BTM route to set an environmental
JH> variable depending on what date range it curently in.
Here's the batch file I use to set my system's clock from the NRC (National
Research Centre) here in Ottawa. It determines whether it's daylight savings
time or standard time. I can't take credit for this part of the batch,
though, it comes from Yousef Khan (sp?).
------------------ start SETCLOCK.BAT ------------------------
rem Check for daylight savings time
set realdate=%_date
set year=%@substr[%_date,6,2]
rem Get Std time fallback date
for %a in (25 26 27 28 29 30 31) do (
date 10-%a-%year
if "%_dow" eq "sun" set stdtmdate=%_date
)
rem Get Daylite time jumpforward date
for %a in (1 2 3 4 5 6 7) do (
date 04-%a-%year
if "%_dow" eq "sun" set daytmdate=%_date
)
date %realdate
rem convert all dates into comparable numbers
set realdate=%@date[%realdate]
set daytmdate=%@date[%daytmdate]
set stdtmdate=%@date[%stdtmdate]
iff %realdate gt %daytmdate .and. %realdate lt %stdtmdate then
rem it's definitely Daylite savings time
set daylite=4
elseiff %realdate eq %daytmdate then
rem right on daylite date
iff %@time[%_time] lt %@time[02:00:00] then
set daylite=5
else
set daylite=4
endiff
elseiff %realdate eq %stdtmdate then
rem right on std time date
iff %@time[%_time] lt %@time[02:00:00] then
set daylite=4
else
set daylite=5
endiff
else
rem Definitely Std time
set daylite=5
endiff
unset realdate,year,stdtmdate,daytmdate
rem Begin calling NRC time beacon
rem echo at&f2&n1s11=40>com1
d:\utility\atsend &f2&n1s11=40 1
echo Today is %_dow, %@word[%@eval[%_month-1],Jan Feb Mar Apr May Jun Jul
Aug Sep Oct Nov Dec] %_day, %_year
iff %daylite=5 then
echo System time is currently %_time Eastern Standard Time
elseiff %daylite=4 then
echo System time is currently %_time Eastern Daylight Savings Time
else
echo System time is currently %_time (Time Zone Unknown)
endiff
echo.
echo preparing to call NRC for time check...
d:\utility\nrc.exe 1 T9527729 -%daylite %_year
rem echo atz>com1
d:\utility\atsend z 1
unset daylite
------------------- END SETCLOCK.BAT ------------------------------
Cheers,
Morris
Morris Turpin
Proud Member of Team OS/2
fidonet: 1:163/307.9
internet: mturpin@igs.net
--- msged 2.07
---------------
* Origin: Warped in Ottawa, Canada (1:163/307.9)
|