home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frostbyte's 1980s DOS Shareware Collection
/
floppyshareware.zip
/
floppyshareware
/
USCX
/
SETPGMS.ZIP
/
SETNOW.DOC
< prev
next >
Wrap
Text File
|
1986-12-22
|
2KB
|
68 lines
SETTIME - Use to set strings in the environment for DATE and TIME
Requires DOS 2.0 or above and 512 bytes of disk and memory space (not resident
when not in use)
Copyright 1986, Arnold B. Krueger GPW MI 48236
(ARNY KRUEGER @EXEC-PC 414-964-5160)
Permission for free use and distribution by
interested parties, not for profit, granted.
SETTIME sets the environment string 'DATE' with the current date: HH:MM:SS.
It also sets the environment string 'TIME' with the current time: MM/DD/YY.
Use SETTIME to access the current date and time from the DOS Batch language,
as illustrated by the following example: (This file is included in SETNOW.ARC
as SETTEST.BAT)
echo off
rem BAT file for logging program use - test file for SETNOW
setnow
echo start at: %time% %date%
set otime=%time%
set odate=%date%
.
. (code to be logged/timed)
.
setnow
echo end at: %time% %date%
echo %odate% %otime% start %date% %time% finish >$temp
copy test.log+$temp test.log >nul
set otime=
set odate=
This example shows how the power of the DOS Batch language is enhanced
by utility programs that update the environment:
The first 2 lines are overhead and self-documentation.
The next 4 lines save and announciate the current date and time.
The lines shown as an elipse (...) are the process to be timed or logged.
The next 4 lines obtain the date and time at the end of the test,
and update a log file named test.log.
The last 2 lines clean up the enironment.
Resolution of SETTIME is one second. There is a variable delay in
running it, depending on the speed of your CPU and disk. Figure on
no better than 2 second accuracy.
ERRORLEVEL setting by this program:
Errorlevel=1 Means the DOS release is not at least 2. An error message is
typed. No changes to the environment result.
Errorlevel=2 Means that the time or date string was too long to fit in the
environment. An error message is typed.
This problem can be avoided by extending the size of the
environment using CONFIG.SYS options, AND running SETNOW in
AUTOEXEC.BAT.