
				 Time and Date

			   Copyright Jason Hood 2000

			     Freeware. Version 1.01


 ===========
 Description
 ===========

 Time and Date (tad) is a utility to set and/or display the time.  It  can  set
 the system time from, or independently of, the real-time clock (RTC). The time
 can be automatically adjusted to counter RTC inaccuracies.


 =====
 Usage
 =====

 The time format is "hh:[mm[:ss]]" where:

	hh is the hour (0 to 23);
	mm is the minute (0 to 59);
	ss is the second (0 to 59).

 No check is made to determine if the time is valid.  Note that the colon after
 the hour is required. If the minutes or seconds are left out, they will be set
 to zero.

 The date format is "dd[/mm[/yy[yy]]]" where:

	dd is the day (1 to 31);
	mm is the month (1 to 12);
	yy is the year (1980 to 2099).

 Again, no check is made to determine the validity  of	the  date  (the  system
 itself prevents invalid dates and times being set).  Any character can be used
 in place of "/" (except colon, of course), but the order  cannot  be  changed.
 Years 00 to 79 are taken as 2000 to 2079, and 80 to 99 as 1980 to 1999. If the
 month and/or year is left out, they are taken as current.

 An option starts with "-" or "/".  Multiple options can be combined (eg. "-nm"
 is the same as "-n -m", "/nm" and "/n/m", but not "-n-m"). Briefly:

	-a	display the approximate time
	-b	display the date and time briefly (concisely)
	-c	display as a clock
	-s	set the system time/date from the real-time clock
	-k	set system time/date, keep the RTC as is
	-n	start a new calibration
	-r	take the given time/use the current system time as reference
	-m	monitor the time for external update
	-d	correct for drift
	-v	view calibration details
	-q	quiet, no display


 If no options are given, the time, day and date is displayed. Eg:

 17:14:45  Wednesday, 21 June, 2000


 a - Approximate time

 The time will be displayed as a five-minute interval, past or to the hour. Eg:

 Quarter past five.


 b - Brief (concise) time

 The date and time will be displayed as a single string. Eg:

 20000621171445

 This option also has an effect on the calibration/drift duration display.


 c - Clock

 The time will be continuously displayed until a key is pressed.


 s - System from RTC

 The system time and date will be set from the real-time clock.


 k - Keep RTC

 The system time and/or date can be set without affecting the RTC.  This option
 allows you to temporarily change the time, restoring it again with "-s".


 n - New calibration

 In order to correct the RTC drift,  tad  needs  to  determine	the  degree  of
 inaccuracy of your clock.   This  option  is  used  to start a new calibration
 measure.  It can either take the system time as correct,  or use the specified
 time. It is also possible to use this in conjuction with "-m", below.  It'd be
 a very good idea not to change the clock during calibration.


 r - Reference

 After the calibration has been started, use this option  to  specify  the  new
 correct time. TAD will then be able to calculate the proper time, compensating
 for the RTC drift. This option should also be used when the  system  time  has
 been changed by another program, otherwise the calculation will be off.


 m - Monitor

 If you use a time server on the net,  this option can be used to determine the
 change in time without  the  need to specify it. It can be used in conjunction
 with "-n" (ie. "-nm") or instead of "-r <time>".  Just  remember  to  run  tad
 before the time server.


 d - Drift

 This is the option that actually corrects the time,  based on the values given
 by "-n" and "-r". It should be placed in autoexec.bat.


 v - View

 Displays the details of the calibration.


 q - Quiet

 Prevents the display of the time when it is set, or calibration/drift details.
 It can also be used with the clock, leaving no output when it is finished.


 ============
 Return Value
 ============

 The return value (errorlevel) is the current 10-minute time interval.
 Hourly quick reference:

	     Midnight	 0	      Noon     72
	      1:00am	 6	     1:00pm    78
	      2:00am	12	     2:00pm    84
	      3:00am	18	     3:00pm    90
	      4:00am	24	     4:00pm    96
	      5:00am	30	     5:00pm   102
	      6:00am	36	     6:00pm   108
	      7:00am	42	     7:00pm   114
	      8:00am	48	     8:00pm   120
	      9:00am	54	     9:00pm   126
	     10:00am	60	    10:00pm   132
	     11:00am	66	    11:00pm   138

 If the help was displayed, no time/date was specified with "-k",  or there was
 trouble with the calibration file, 255 will be returned.

 Have a look at greet.bat for a simple use of the return value.


 ===============
 Acknowledgments
 ===============

 Ralf Brown's Interrupt List and Bob Stout's C Snippets.


 =======
 Contact
 =======

 jadoxa@hotmail.com
 http://adoxa.homepage.com/tad/

 Jason Hood
 11 Buckle Street
 North Rockhampton
 Qld 4701
 Australia


 ============
 Distribution
 ============

 The original zipfile can be freely distributed, by any means. However, I would
 like to be informed  if  it  is  placed  on  a  CD-ROM  (other than an archive
 compilation).	Modified versions may be distributed, as long as  the  original
 zipfile is included (I would prefer to be contacted).


 ==========================
 Jason Hood, 15 July, 2000.
