home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
-
-
-
-
-
-
- TIMECHEK
-
-
- a SMILEWARE :-) product of
-
-
- Steve Antonoff
- 3917 Garfield Drive
- Stone Mountain, GA 30083
-
- 1:133/302.0@fidonet, (404) 296-9681
- Operates 24 hours
-
- File Requests & Downloads not available
- during FIDOnet Zone Mail Hour (09:00 - 10:00 UCT)
-
-
- Updated May 12, 1992
-
- TIMECHEK is copyright, 1987, 1990, 1992 by Steve Antonoff
- and is released for public non-commercial use and distribution.
- No fees, royalties, licenses are required for non-commercial use.
-
-
-
-
-
-
- TIMECHEK is an outgrowth of TIME96. TIMECHEK can function
- just like TIME96 (it has all of TIME96's capabilities) plus one
- additional feature that makes it much easier to use. TIMECHEK
- checks the system clock for the time of day, day of week, etc,
- and exits with an ERRORLEVEL based on that time and the arguments
- presented with the command. For version 2.0, there is no default
- mode. Version 2.1 adds the "hour of day" and "minute of hour"
- capabilities.
-
- The original mode of TIME96, and the old default mode of
- TIMECHEK, can be accessed by use of a /T command line parameter.
- In this mode, the 24 hour day is broken into 96 fifteen minute
- intervals. Thus, between midnight (00:00:00) and quarter past
- (00:14:59), timechek returns an errorlevel of 1; at 6:00:00 AM,
- it returns an errorlevel of 25, at noon an errorlevel of 49, etc.
-
- Through use of this program, a batch file can do different
- things based on time of day, day of week, etc. It was written to
- allow different parameters to be passed to a FIDOnet mail proces-
- sor based on the time.
-
-
-
-
-
-
-
- The current version of TIMECHEK has several arguments which
- affect the program's behaviour:
-
- Q: any argument beginning with a -Q (quite) suppresses the
- generation of the copyright and time of day printout;
-
- W: any argument beginning with a -W causes TIMECHEK to return an
- argument based on the DAY OF WEEK in place of the TIME OF DAY
- (1=Sunday, 2=Monday, etc.);
-
- M: any argument beginning with a -M causes timechek to return
- the MONTH (Jan = 1, etc);
-
- D: any argument beginning with a -D causes TIMECHEK to return
- the day of the month (ie, 9/22/87 -> 22);
-
- Y: any argument beginning with a -Y causes TIMECHEK to return
- the year (2 digit).
-
- H: any argument beginning with a -H causes TIMECHEK to return
- the hour of the day (0-23).
-
- :: any argument beginning with a colon (/:) causes TIMECHEK to
- return the minute within the hour (0-59).
-
- R: any argument beginning with a -R puts TIMECHEK into the RANGE
- mode. The program will scan the remaining arguments and
- return the number of the FIRST range that matches the current
- time. Ranges are of the form
-
- DD#DD#DD:ssss-eeee/l
-
- where:
-
- DD is a day of the week (enought character to make it
- unique in English: SU, M, TU, W, TH, F, SA), WK (weekdays),
- WN (weekends) or A (all days). Multiple days may be "or-ed"
- together with #, thus M#WMF means Monday or Wednesday or
- Friday. More letters than the minimum can be used, so FRIDAY
- is the same thing as F.
-
- ssss is the start time (expressed as a number between 0 and
- 2400). If no start time is specified, 0000 is assumed.
-
- eeee is the end time (expressed as a number between 0 and 2400).
- If no end time is specified, 2400 is assumed.
-
- l is the errorlevel to return if this range is the match. If no
- level is specified, the ordinal number of the range within
- the command line is used.
-
- With version 2.0, the structure of the range parameters is
- much more flexible: the number of letters in the day of the week
- parameter is flexible, the numbers of digits in the start and end
- time is flexible, and the user can specify an errorlevel with the
-
-
-
-
-
-
- range.
-
- The T, M, D, W, Y, H, : and R options are mutually exclusive,
- and only the LAST one entered will be in effect. These arguments
- can be upper or lower case and must be preceded by a - or a /
- [this is a change from TIME96, where the - and / were optional].
- All of the following are legal:
-
- timechek
- The above example displays an on-line help message.
- TIMECHEK /W
- TIMECHEK /Q /m
- TIMECHEK /Q /d
- TIMECHEK /w -q
- timechek -t
- timechek -r al:0400-0500 al:2300-2400 al:0000-0700 ....
- .... sa:0000-2400 su:0000-1700
- (The last sample is too long to fit on one line in this
- document, but the sa: and the su: go on the same line as the
- other arguments. This basically says: if the current time
- is between 0400 and 0500, return errorlevel 1, if the time
- is between 2300 and 2400 return 2, if the time is between
- midnight and 7am return 3, if it is Saturday (and not one of
- the preceeding times) return 4 and if it is Sunday (again,
- not one of the preceeding times) return 5. Thus, with one
- command, a BAT file can detect National Mail Hour (errorlev-
- el 1) and cheap long distance rates in the US (return levels
- 2-5). A errorlevel of 0 indicates higher than minimum long
- distance rates and not NMH.
-
- timechek -r A:400-500 a:2300 a:-700 sa su:-1700
- This example has the same effect as the previous one but
- uses a more compact format.
-
-
-
-
-
-
-
- Example Table of return values
-
- Day Time -T -H -W option
- Sun 00:00 1 0 1
- Sun 06:00 25 6 1
- Sun 12:00 49 12 1
- Sun 18:00 73 18 1
- Sun 23:45 96 23 1
-
- Mon 00:00 1 2
- Mon 06:00 25 2
- Mon 12:00 49 2
- Mon 18:00 73 2
-
- Tue 00:00 1 3
- Wed 00:00 1 4
- Thu 00:00 1 5
- Fri 00:00 1 6
- Sat 00:00 1 7
- Sat 23:45 96 7
-
-
-
-
-
-
-
-
- Sample use - timechek compatible runs:
- timechek -w
- if errorlevel 7 goto SATURDAY
- if errorlevel 6 goto FRIDAY
- if errorlevel 5 goto THURSDAY
- if errorlevel 4 goto WEDNESDAY
- if errorlevel 3 goto TUESDAY
- if errorlevel 2 goto MONDAY
-
- :SUNDAY
- rem Sunday is cheap until 5PM (69)
- timechek -t
- if errorlevel 69 goto OMMMHOLD
- goto OMMMSEND
-
- :MONDAY
- :TUESDAY
- :WEDNESDAY
- :THURSDAY
- :FRIDAY
- rem 93 is 23:00, 29 is 07:00 - between 7am &
- rem 11 PM HOLD all long distance
- rem before 7 and after 11 don't hold
- timechek -t
- if errorlevel 93 goto OMMMSEND
- if errorlevel 29 goto OMMMHOLD
- goto OMMMSEND
-
- :SATURDAY
- rem Saturday is ALWAYS cheap, so send stuff
- goto OMMMSEND
-
- Sample run - RANGE option:
-
- timechek -r a:400-500 sa su:-1700 al:2300 al:-0700
- if errorlevel 2 goto CHEAPMAIL
- if errorlevel 1 goto ZMH
- goto OMMMHOLD
-
-
- Notes and caveats:
-
- 1) This program was compiled with Turbo C version 2.0. Time
- zones are not supported: the program reports and operates on
- the time as returned by the DOS clock.
-
- 2) The Y, H, : and R options are the only options which can
- return an errorlevel of 0 (zero). All others return a mini-
- mum of a 1. No check is made to verify that the clock/calen-
- dar make sense: whatever DOS reports, that's what is re-
- turned.
-
- 3) This program has been tested with PC-DOS 3.20, MS-DOS 3.21
- MS-DOS 3.30 and MS-DOS 5.00. Other versions of DOS should
- work fine, but they have not been tested.
-
-
-
-
-
-
-
- 4) The August 4, 1988, version corrects an oversight: WE was
- used for both WEdnesday and WEekends. The code for WeekeNds
- was changed to WN.
-
- 5) By error, the wrong doc file was included in the January,
- 1988 release. The file was a WordStar document file. This
- version includes the correct plain text file, formatted for
- 8.5 x 11 inch paper, with form feeds, etc.
-
- 6) The license for version 2.0 and higher has been changed to
- permit free use only in NON-COMMERCIAL environments. For
- commercial use, contact the author, Steve Antonoff, at the
- address listed above.
-
- 7) Timechek is now included in the BBS_TIME utilities distribu-
- tion set (BBS_TIME.ZIP).