home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
lan
/
g0bsx
/
timer.doc
< prev
next >
Wrap
Text File
|
1989-04-26
|
4KB
|
96 lines
the file: TIMER.EXE is used in the following manner:
It must be used in a batch file or be called from another program.
If used in a batch file, it will return an errorlevel of either 0 or 1.
Usages:
=======
A. As a simple timeout system:
-----------------------------
It will return a 1 if a timout has occured and a 0 if it has not.
If program is used with a SINGLE parameter, this must be the time in seconds
to be tested for since the last timeout.
e.g. if you say: timer 100, and more than 100 seconds have elapsed since
the last time a timout was successful, a 1 will be returned, if not, a 0
will be returned.
example (in a batch file):
timer 120
if errorlevel = 1 backup
will cause the program "backup" to be executed if more that 2 minutes have
elapsed since the last the timer program has been used in the timeout mode.
B. As a generalised timeout system:
----------------------------------
* Syntax: timer -opts number
* Example: timer -th 3 will time out if more that 3 hours have passed
since the last successful imeout.
Possible options:
-ty - number is in terms of years (!!)
-tn - number is in terma of months
-td - number is in terms of days
-th - number is in terma of hours
-tm - number is in terms of minutes
-ts - number is in terms of seconds
C. As an interval tester:
------------------------
* Syntax: timer -opts n1n2
* Examples: timer -ih 0008 will return 1 if the current hour is between 00h
and 08h (inclusive) IF timer has not been used in
this mode successfully in the current hour. i.e.
only ONE true value will be returned per hour.
timer -iw 56 will return 1 if the current DAY OF WEEK is 5 or
6 and timer has not already been used
successfully in this mode today.
timer -om 0040 will return 1 if the current minute is NOT in the
range 00 to 40 (inclusive) provided timer has not
been used in this mode in the current minute.
* Possible options:
-ab where a is one of: i - Inside a range
o - Outside a range
where b is one of: y - year. number must be 4 digits long, eg 8990
n - month. number must be 4 digits long, eg 0205
d - day. number must be 4 digits long, e.g. 2225
w - day of week. number must be 2 digits. e.g. 01
h - hour. number must be 4 digits long. e.g. 0023
m - minutes. number must be 4 digits long.
s - seconds. number must be 4 digits long.
* further examples:
timer -iw 00 will cause a single possitive result on sunday
timer -oh 1723 will cause a positive result once each hour (if run frequently)
OUTSIDE the hours 17h to 23h.
NOTE: timer values are held INDEPENDENTLY for each TIME mode. Therefore, a
MINUTE based call with timer does not interfere with an HOUR based call,
and so on. TIMER can therefore be run several times in a batch file in
different modes without interaction:
e.g. timer -ih 0006
if errorlevel 1 morningprog
timer -iw 00
if errorlevel 1 sundayprog
timer -id 2830
if errorlevel 1 endofmonthprog (run each day for 3 days in this
example)
General Note:
-------------
TIMER maintains a data file by the name of TIMER.DAT in the current directory.
If desired, multiple different and independent systems can be run by simply
defining different directories and changing to these in turn to access
different TIMER.DAT files....
hope this is useful, Peter G0BSX @ GB7PLY