home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / UTILITY / SYSTEM / UDATE.ZIP / UDATE.DOC next >
Encoding:
Text File  |  1990-06-07  |  12.7 KB  |  330 lines

  1.  
  2.  
  3.     Program:  udate
  4.  Programmer:  George Kerber
  5.     Written:  12/17/89 - 05/28/90
  6.    Compiler:  Turbo "C"
  7. Application:  MS-DOS
  8.     Version:  1.21p
  9.     History:  Converted to MS-DOS from the AmigaDOS 'udate' & 'dst' programs.
  10.  
  11.     Purpose:  Displays the date and/or time in any format, including the
  12.               current timezone.
  13.  
  14.               Closely emulates the UNIX date command for date string
  15.               formatting.  Supports all of the UNIX format characters and
  16.               adds others.
  17.  
  18.               Automatically adjusts the clock for daylight savings time.
  19.  
  20.               Sets the date and time.
  21.               (replacing the MS-DOS 'date' & 'time' command)
  22.  
  23.  
  24. SYNTAX: udate [[?][hh:mm|mm/dd/yy][-help][-dst|-DST][["format string"][NOLINE]]]
  25.  
  26.      udate               Displays the date & time in the default format.
  27.                          (the default is user configurable, see below)
  28.      udate  ?            Displays a help screen.
  29.      udate hh:mm         Sets the computer time.
  30.      udate mm/dd[/yy]    Sets the computer date.
  31.      udate  -help        Displays a help screen for setting the TIMEZONE,
  32.                          ESCAPE & DEFAULT variables.
  33.      udate  -dst|-DST    Automatically adjusts the system clock for daylight
  34.                          savings time.
  35.      udate  ... NOLINE   A newline is not automatically output.
  36.  
  37.  
  38. If udate is executed with no options the date and time will be displayed in
  39. the default format.  If the 'timezone' variable is set (see below), then the
  40. current timezone is also displayed.  The default format is:
  41.  
  42.      ddddd dd-mmm-yy hh:mm tzn
  43.  
  44. (see below for directions on changing the 'default' date string)
  45.  
  46.  
  47. A formatted string can be given as an option to display the date and/or time
  48. exactly as desired.  If any spaces are to be included in the format string,
  49. the entire format string must be quoted.  Literal spaces and characters can
  50. be included in the format string.  See the examples below.
  51. By default the escape character is a backslash (\), but can be changed.  See
  52. below for directions.  The format characters are described below.
  53.  
  54.      \a  abbreviated weekday name
  55.      \A  full weekday name
  56.      \b  abbreviated month name
  57.      \B  full month name
  58.      \d  day of month - 01 to 31
  59.      \e  day of month -  1 to 31 (with leading space, if < 10)
  60.      \I  hour - 01 to 12
  61.      \i  hour - 1 to 12   (not available in UNIX)
  62.      \H  hour - 00 to 23
  63.      \m  month of year - 01 to 12
  64.      \n  insert a new-line character
  65.      \t  insert a tab character
  66.      \r  time as hh:mm:ss pp (AM/PM)
  67.      \T  time as hh:mm:ss
  68.      \R  time as hh:mm
  69.      \S  second - 00 to 59
  70.      \j  julian day of year
  71.      \J  days remaining in year   (not available in UNIX)
  72.      \y  two digit year
  73.      \Y  four digit year
  74.      \D  date as mm/dd/yy
  75.      \x  day of month extension (th, st, nd or rd)
  76.      \M  minute - 00 to 59
  77.      \p  string, "AM" or "PM"
  78.      \w  day of week - Sunday = 0
  79.      \W  day of week - Sunday = 1   (not available in UNIX)
  80.      \u  date/time display in UNIX default format
  81.          ddd mmm dd hh:mm:ss tzn* yyyy
  82.      \Z  timezone*
  83.      \g  date/time display, greeting format   (not available in UNIX)
  84.      \1  Textcolor lightblue.
  85.      \2  Textcolor lightgreen.
  86.      \3  Textcolor lightcyan.
  87.      \4  Textcolor lightred.
  88.      \5  Textcolor lightmagenta.
  89.      \6  Textcolor yellow.
  90.      \8  Textcolor white (bold)
  91.      \9  Restores text color to the system default.
  92.      \$  displays the date/time in the default format.
  93.          ddddd dd-mmm-yy hh:mm tzn
  94.          This 'default' display IS NOT changed by changing the DEFAULT
  95.          variable as described below.
  96.  
  97.  
  98.      \"  Prints a literal quote in the format string.
  99.  
  100.          Enter the 'escape' character twice with no space to print a
  101.          literal 'escape' character.
  102.  
  103.       *  Timezone will be displayed if set as described below.  No errors
  104.          are shown if the timezone variable is not set.
  105.  
  106.  
  107. Examples:  udate                                           /*  default       */
  108.            Mon 18-Dec-89 09:51 MST
  109.  
  110.            udate 9:51                                      /*  set the time  */
  111.            Date: December 18, 1989   New Time: 09:51
  112.  
  113.            udate 12/18                                     /*  set the date  */
  114.            New Date:  December 18, 1989  Time: 09:51
  115.  
  116.            udate "Today is \A \B \d\x, \Y"
  117.            Today is Monday December 18th, 1989
  118.  
  119.            udate \g             /*  this is good for your autoexec.bat file  */
  120.            Good Morning!   Today is Monday, December 18th at 9:53 AM (MST)
  121.  
  122.            udate "\n\o George,\n\n\k\n"                     /*  or this      */
  123.  
  124.            Good Morning George,
  125.  
  126.            Today is Monday, December 18th at 9:53 AM (MST)
  127.  
  128.  
  129.            udate "Date/Time display in UNIX format\n\u"
  130.            Date/Time display in UNIX format
  131.            Mon Dec 18 09:54:21 MST 1989
  132.  
  133.  
  134.  
  135. SETTING THE DATE & TIME:
  136.  
  137. If udate is executed with a string that resembles a date or time, then
  138. udate will attempt to change the computer clock to the new date or time.
  139. The system clock will always be changed, but the battery backup clock may
  140. or may not be changed.  See your computer documentation for more
  141. information about the battery backup clock.
  142.  
  143. Change Time:  udate hh:mm
  144.  
  145.               The seconds are automatically set to 00 each time the time
  146.               is changed.
  147.  
  148. Change Date:  udate mm/dd[/yy]
  149.  
  150.               The year is optional, if no year is entered, then the
  151.               current year will be retained.
  152.  
  153. NOTE:  The 'udate' program can be used as an 'echo' command if desired.
  154.        Because of how 'udate' determines if the user is trying to
  155.        change the date or time, you can't simply 'echo' a constant date
  156.        or time using udate.  For example, if you enter:
  157.  
  158.        udate 12/23/89
  159.  
  160.        udate will change the date to 12/23/89, rather than 'echo' 12/23/89
  161.        to the screen.  You could enter:
  162.  
  163.        udate  "12/23/89 "
  164.  
  165.        to actually 'echo' 12/23/89 to the screen.  Notice the extra literal
  166.        space at the end, this 'tricks' udate into thinking that you are
  167.        not entering a valid date.
  168.  
  169.        Or you could use the MS-DOS 'echo' command to do the same thing, which
  170.        would be slightly quicker since 'echo' is a built-in command.
  171.  
  172.  
  173. SETTING THE TIMEZONE VARIABLE:
  174.  
  175. Add the following line to your autoexec.bat file:   (if desired)
  176.  
  177. set TIMEZONE=tzn[:dst]
  178.  
  179. where 'tzn' = the current standard timezone for your area.
  180. (EST, CST, MST, PST, etc)  All three characters must be used.
  181.  
  182. where 'dst' = the optional timezone for your area when daylight savings time
  183. is in-effect.  (EDT, CDT, MDT, PDT, etc)  If your area does not observe
  184. daylight savings time, then only enter 'tzn' as described above.
  185. If 'dst' is used, you must use all three characters and use an ':' as
  186. a field separator.
  187.  
  188. Examples:  set TIMEZONE=EST:EDT
  189.            set TIMEZONE=MST:MDT
  190.            set TIMEZONE=PST
  191.  
  192. The TIMEZONE variable must be set exactly as shown or 'udate' will
  193. completely ignore it.  Setting the TIMEZONE is optional, but the current
  194. timezone will not be displayed if it isn't set.
  195.  
  196.  
  197. CHANGING ESCAPE CHARACTER DEFAULT:   (if desired)
  198.  
  199. By default the 'escape' character for the format string is a backslash (\).
  200. This can be changed by the user to conform to MS-DOS 'standard' or anything
  201. else for user preference.  For example to set the 'escape' character to
  202. a '%' add the following line to your autoexec.bat file:
  203.  
  204.            set ESCAPE=%
  205.  
  206.            (a '%' is the standard UNIX escape character for the 'date' command)
  207.  
  208. Now the format string will require a '%s instead of a '\' when using the
  209. format characters.  This is the line to change the 'escape' character
  210. to a forward slash (or modifier in MS-DOS format):
  211.  
  212.            set ESCAPE=/
  213.  
  214. If the ESCAPE variable is set to more than one character, only the first
  215. character will be used.  Changing the default escape character is optional,
  216. and is normally not necessary unless you 'despise' using backslashes for this
  217. purpose.
  218.  
  219.  
  220. CHANGING THE DEFAULT DATE STRING:   (if desired)
  221.  
  222. By default the date and time is presented to the user is:
  223.  
  224.      ddddd dd-mmm-yy hh:mm tzn
  225.  
  226. when no options are given.  This can be changed by the user by setting
  227. the 'DEFAULT' variable.  The DEFAULT variable should contain a string
  228. containing text and/or format characters as would be entered as options
  229. to udate to produce the formatted string.  For example, to change the
  230. 'default' date/time string to:
  231.  
  232.      UNIX format date is ddd mmm dd hh:mm:ss tzn* yyyy
  233.  
  234. add this line to your autoexec.bat file:
  235.  
  236.      set DEFAULT=UNIX format date is \u
  237.  
  238. The DEFAULT date string must contain the correct 'escape' character.  The
  239. default 'escape' character is a backslash, but can be changed as described
  240. above.  Changing the 'default' default datestring is optional and should
  241. only be done is you desire a different 'default' date/time string.
  242.  
  243. The original 'default' date string can always be displayed by using
  244. the '$' format character.
  245.  
  246.  
  247. AUTOMATIC DAYLIGHT SAVINGS TIME ADJUSTMENT
  248.  
  249. udate will automatically keep your clock set for the correct time while
  250. daylight savings time is in effect and while it's not.  There are two
  251. options to use depending on how your PC handles the battery clock.
  252.  
  253. If the battery clock of your PC is changed by using the MS-DOS date and time
  254. command, then use -DST.  If your PC requires a special command to write the
  255. system clock time to the battery clock then use -dst.  If you use the -DST
  256. command, a file named 'udate.dst' will be written to the root directory of
  257. your c: drive during daylight savings time.  Do not delete this file!
  258.  
  259. Example:  Add one of these lines to your autoexec.bat file
  260.  
  261.       udate -dst   --Used if the MS-DOS date/time commands only change the
  262.                      system clock, but leave the battery clock unchanged.
  263.       udate -DST   --Used if the MS-DOS date/time commands change both the
  264.                      system clock and the battery clock.
  265.  
  266. Set your battery clock to standard time in your area and add one of the
  267. above lines to your autoexec.bat file.  If a command is necessary in the
  268. autoexec.bat file to read the battery clock, the 'udate -dst' line must
  269. follow the readclock command.
  270.  
  271. The 'udate -dst' command should only be executed once per login session.  The
  272. 'udate -DST command (if used) can be executed many times, but there is no
  273. reason to do so.
  274.  
  275. If setup properly, you will NEVER have to do the twice yearly ritual of
  276. resetting your computer clock for daylight savings time.
  277.  
  278. If the time ever seems to be screwed up, delete the udate.dst file if it
  279. exists in the root directory of c:, set your clock to standard time and
  280. reboot.  Note that the 'c:\udate.dst' file is "hidden" and cannot
  281. be seen with the MS-DOS dir command.
  282.  
  283.  
  284. BUGS
  285.  
  286. The program can become confused if it is executed twice using one of the
  287. daylight savings time options between 2 and 3 am on the day that daylight
  288. savings time is over.  (late October)  This seems like a minor bug
  289. and shouldn't show up very often since it can only occur if the
  290. computer is booted in the early hours of the morning on the change over
  291. date and then rebooted before the hour is up.
  292.  
  293.  
  294. UNIX?
  295.  
  296. This program includes all of the UNIX date command format characters.
  297. The format string is a little different.  The UNIX date command uses a '%'
  298. as an escape character for the format characters.  I know why the UNIX
  299. command uses the '%' but MS-DOS and AmigaDOS has no need, so I chose to use
  300. a backslash '\' instead.  Also the UNIX date command requires that all
  301. format strings begin with a '+'.  Again I saw no need, so I didn't require
  302. it.  The default date string for 'udate' is different than the UNIX version,
  303. but I added a format character '\u' to display the date in the UNIX default
  304. format.  The 'udate' command follows 'standard' UNIX convention for
  305. options instead of the MS-DOS convention.  If desired, the udate
  306. command can be configured for UNIX or MS-DOS 'standards' as described
  307. above by setting the DEFAULT and ESCAPE variables.
  308.  
  309.  
  310. PROGRAM HISTORY
  311.  
  312. This program is actually a 'hacked' combination of my 'udate' and 'dst'
  313. programs that I wrote in Lattice "C" for the Commodore Amiga computer.
  314.  
  315.  
  316. PUBLIC DOMAIN
  317.  
  318. This program is released to the public domain.  Please feel free to use and
  319. distribute this program.  I do insist that the udate.exe and udate.doc
  320. files are distributed together and that I am kept as the author.
  321. I'm not responsible for any problems with this program or problems that
  322. may be attributed to it.  (I hate responsibility).
  323.  
  324.  
  325.  
  326.                            George Kerber
  327.                            19756 E. Linvale Drive
  328.                            Aurora, CO  80013
  329.                            303-693-2890
  330.