home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / BBS / MISC / BBS_TIME.ZIP / BBS_TIME.DOC < prev    next >
Encoding:
Text File  |  1991-06-16  |  7.5 KB  |  208 lines

  1.  
  2.  
  3.  
  4.  
  5.                                BBS Time Utilities
  6.  
  7.                   Three time utilities to facilitate operation
  8.                   of DOS based BBS's and other 24 hour per day
  9.                                    operations.
  10.  
  11.                                      IS_DST
  12.                                     ADJ_TIME
  13.                                     TIMECHEK
  14.  
  15.                          Copyright 1991, Steve Antonoff
  16.                                 3917 Garfield Dr.
  17.                             Stone Mountain, GA  30083
  18.  
  19.                                FIDOnet: 1:133/302
  20.                                 EGGnet: 99:9000/6
  21.  
  22.                                   June 16, 1991
  23.  
  24.                       BBS Time Utilities by Steve Antonoff
  25.  
  26.  
  27.  
  28.         IS_DST - checks for Daylight Savings Time in the USA
  29.         ADJ_TIME  -  adjusts  DOS system clock by n  hours  (positive  or
  30.         negative)
  31.  
  32.         IS_DST  and ADJ_TIME were writted to accommodate the  semi-annual
  33.         insanity of changing the clock.
  34.  
  35.         IS_DST will check the current DATE and determine if the  Daylight
  36.         Savings Time is in effect, based on current (6/16/91) laws of the
  37.         USA  which define Daylight Savings Time as being in  effect  from
  38.         the  first  Sunday in April through the last Sunday  in  October.
  39.         IS_DST  does NOT check for the time of day (that is,  it  assumes
  40.         that the time change occurs at midnight, not at 2AM). As a result
  41.         of  this, it is best if it is NOT run between midnight  and  1:00
  42.         A.M.  More on this later!
  43.  
  44.         ADJ_TIME  will  adjust the system clock forward or  backward  the
  45.         specified  number  of  hours.   There are  two  common  uses  for
  46.         ADJ_TIME: (1) daylight savings time on/off and (2) changing  time
  47.         zones for portable computers.
  48.  
  49.         Usage:
  50.  
  51.         IS_DST will set the DOS errorlevel to 1 if Daylight Savings  Time
  52.         is in effect; it will set the errorlevel to 0 if Daylight Savings
  53.         Time  is  NOT  in  effect.   Here's  how  I  use  IS_DST  in   my
  54.         AUTOEXEC.BAT file:
  55.  
  56.         is_dst
  57.         if errorlevel 1 got DST
  58.         set TZ=EST5
  59.         del c:\EDT
  60.         echo x>c:\EST
  61.         goto TZCONTINUE
  62.         :DST
  63.         del C:\EST
  64.         echo x>c:\EDT
  65.         set TZ=EDT4
  66.         :TZCONTINUE
  67.  
  68.         The flag files (EDT and EST) are used to keep track of what  time
  69.         was  in  effect when the system last booted.   These  files  will
  70.         enable  the  BBS to automatically adjust its time when  the  time
  71.         changes.
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.                Copyright 1991, Steve Antonoff, Stone Mountain, GA
  85.                                      Page 1
  86.  
  87.                       BBS Time Utilities by Steve Antonoff
  88.  
  89.  
  90.         My nightly cleanup starts at 2:15 AM, a perfect time to check for
  91.         the start or end of Daylight Savings Time.  So, in my CLEANUP.BAT
  92.         file,  which  is executed at 2:15 AM every night by  my  BINK.BAT
  93.         file, I have:
  94.  
  95.         ---------------------------------------------------------------
  96.         rem check to see if between midnight and 1 am - for safety sake
  97.         timechek -r 00:00 01:00
  98.         if errorlevel 1 goto TZEND
  99.         is_dst
  100.         if errorlevel 1 goto DST
  101.  
  102.         :EST
  103.         rem Eastern Standard Time is in effect
  104.         rem if C:\EST exists, don't do anything
  105.         if exist c:\est goto TZEND
  106.         rem Change from DAYLIGHT to STANDARD time!
  107.         rem Set TZ variable
  108.         set TZ=EST5
  109.         rem Adjust system clock
  110.         adj_time -1
  111.         rem delete EDT flag file
  112.         del c:\edt
  113.         rem create EST flag file
  114.         echo x>c:\est
  115.         goto TZEND
  116.  
  117.         :EDT
  118.         rem Eastern Daylight Time is in effect
  119.         rem if C:\EDT exists, don't do anything
  120.         if exist c:\edt goto TZEND
  121.         rem Change from STANDARD to DAYLIGHT time!
  122.         rem Set TZ variable
  123.         set TZ=EDT4
  124.         rem Adjust system clock
  125.         adj_time 1
  126.         rem delete EST flag file
  127.         del c:\est
  128.         rem create EDT flag file
  129.         echo x>c:\edt
  130.  
  131.         :TZEND
  132.         ---------------------------------------------------------------
  133.  
  134.         Ok,  why  the check for times between midnight and  1AM?   Here's
  135.         what  could happen (an unlikely scenario, but Murphy lives at  my
  136.         house!):
  137.  
  138.         Suppose the for some reason, (system crash or locked up, etc) the
  139.         cleanup  procedure  is run between midnight and 1AM,  and  it  is
  140.         going  to make the time adjustment from Daylight Savings Time  to
  141.         Standard Time.  Without the trap, the time would be adjusted back
  142.         an hour, to a time BEFORE MIDNIGHT.  Because of the way  ADJ_TIME
  143.         was  written, the date is adjusted correctly, making  it  between
  144.         11PM  and  midnight on the previous day.  Well, now  IS_DST  will
  145.  
  146.  
  147.                Copyright 1991, Steve Antonoff, Stone Mountain, GA
  148.                                      Page 2
  149.  
  150.                       BBS Time Utilities by Steve Antonoff
  151.  
  152.  
  153.         report  that it IS daylight savings time, again, and the  process
  154.         could  loop for an hour, changing from Daylight to  Standard  and
  155.         back  again!   So, it is safest to use TIMECHK to  eliminate  the
  156.         possibility  of  moving  the time between midnight  and  1AM.   I
  157.         suppose I could have written IS_DST to check for the time on  the
  158.         acutal  switch-over  day,  but,  hell, this  is  a  hobby,  ain't
  159.         it?
  160.  
  161.         Pseudo Legalese:
  162.  
  163.         Both  IS_DST and ADJ_TIME are hereby released for  non-commercial
  164.         public  use and distribution.  Commercial users,  please  contact
  165.         the  author at one of the addresses below.  All rights  reserved.
  166.         The programs and this documentation are Copyright, 1991, by Steve
  167.         Antonoff.
  168.  
  169.         To contact the Author:
  170.  
  171.         As  of  the time of release of this software, the author  can  be
  172.         contacted by normal mail at:
  173.  
  174.              Steve Antonoff
  175.              3917 Garfield Dr.
  176.              Stone Mountain, GA  30083
  177.  
  178.         or  via FIDOnet at address 1:133/302 or EGGnet at 99:9000/6.   My
  179.         BBS phone number is (404) 296-9681.  All of the above is  subject
  180.         to change, of course.
  181.  
  182.         Warranty:
  183.  
  184.         These programs are guaranteed not to cause solar flares on  Gamma
  185.         Hydra 4 (or was it Gamma Hydra 2?)  Other than that, the programs
  186.         are  provided  as-is.  Bug reports and/or  modification  requests
  187.         will be considered on an "as time permits" basis by the author.
  188.  
  189.         Non-USA considerations:
  190.  
  191.         As  previously indicated, IS_DST will only perform  correctly  in
  192.         the  United  States of America, and even there only  as  long  as
  193.         Congress  doesn't mess with the laws regarding  Daylight  Savings
  194.         Time.   Should non-USA sysops wish to make use of IS_DST, I  will
  195.         consider adding other country's or region's rules if someone will
  196.         define them to me properly.
  197.  
  198.         Miscellaneous:
  199.  
  200.         TIMECHEK  has been included in BBS_TIME.ZIP just to form  a  com-
  201.         plete  set; the only changes were to bring the source code up  to
  202.         ANSI C standards and to make the copyright notice consistent with
  203.         ADJ_TIME and IS_DST.
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.                Copyright 1991, Steve Antonoff, Stone Mountain, GA
  211.                                      Page 3
  212.  
  213.  
  214.