home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / dyltswch.lzh / DYLTSWCH.LWP (.txt) < prev    next >
IBM Works for OS/2  |  1995-04-06  |  10KB  |  68 lines

  1. IBM Works OS/2
  2. Copyright (C) Footprint Software Inc. 1993-1994
  3. PSCRIPT
  4. IBM 4039 LaserPrinter (600 Dpi)
  5. IBM40391
  6. Legalese
  7. The computer program documented here is the copyrighted property of David William Noon, published in 1995. This program may be distributed freely, provided that the copies distributed are not altered from the original and that no charge is levied beyond the price of the medium of distribution. The author does not relinquish the rights of this intellectual property.
  8. Overview
  9. Twice a year, every year, it becomes necessary to change the Time-Of-Day (or TOD) clock on every computer you own. This is a chore that the computer itself should be able to handle. Well, now it is able to handle it.
  10. The switching to and from Daylight Saving Time can now be automated by means of a program that remains in the background using no CPU cycles except on those two occasions each year when the clocks need to be changed. Such a program is included in the archive with this document.
  11. The Program
  12. The program DYLTSWCH.EXE functions under OS/2 like a daemon does under Unix. It "sleeps" in the background, waking up only at selected times. When it does wake up it adjusts the machine's TOD clock and then goes back to sleep for another 6 months (or so).
  13. Since I have included the source code in the archive you can see for yourself how this is achieved. The DELAY statement of PL/I is a thin wrapper over the DosSleep() API call.
  14. Defining Your Time Zone to the Operating System
  15. The program uses the TZ environment variable. This variable defines the time zone in which the computer resides; its value can be set by means of a SET command, preferably in your CONFIG.SYS file. This variable is one OS/2 has inherited from Unix and the default settings are for Bell Laboratories in New Jersey, where Unix was first developed. The following is the definition of the fields within the TZ variable.
  16. Thus, the time zone variable is coded as:
  17. SET TZ=SSS[+|-]nDDD[,sm,sw,sd,st,em,ew,ed,et,shift]
  18. As you can see from the table, all the defaults apply to the Eastern Standard Time zone of the United States.
  19. The only sub-parameters that might need further description are the 'sw' and 'ew' fields. These tell the system whether the starting/ending day for DST is specified as a day of the month or a day of the week within a given week of the month. If the value for 'sw' or 'ew' is zero then the corresponding 'sd' or 'ed' is a day of the month. If the value for 'sw' or 'ew' is positive then the corresponding 'sd' or 'ed' is a day of the week (0=Sunday, 1=Monday, . . .) and 'sw' or 'ew' defines which occurrence of that day of the week within the month (1=first, 2=second, 3=third, 4=fourth). If the value for 'sw' or 'ew' is negative then the corresponding 'sd' or 'ed' is a day of the week (as before) and the 'sw' or 'ew' defines which occurrence of that day of the week reversing from the end of the month (-1=last, -2=second last, -3=third last, -4=fourth last).
  20. How to Start the Program
  21. This program must be in the system at the very instant that switching to or from DST is to occur. It cannot know when it is started that the clock needed to be changed several hours or days ago. Thus, it is best that you start the program every time you boot your machine.
  22. If you live outside the U.S. eastern time zone
  23. , I suggest that you include in your CONFIG.SYS a SET statement that establishes your time zone. Since the SET statements in CONFIG.SYS have not been processed at the time the RUN= statements are processed, you will need to delay the starting of the program until after CONFIG.SYS has been fully processed. Hence, you should use the STARTUP.CMD file and place in it the line
  24. DETACH x:\directory\DYLTSWCH.EXE
  25. This will create a minimal-resource background process after the TZ variable has been set.
  26. Alternatively, you can place the time zone parameters on the RUN= statement in your CONFIG.SYS, as follows:
  27. RUN=x:\directory\DYLTSWCH.EXE GMT0BST,4,1,0,3600,10,-1,0,7200,3600
  28. [Note that the above example is for the British Isles and all other places in the Greenwich time zone.]
  29. If you live within the U.S. eastern time zone
  30. , simply add the line
  31. RUN=x:\directory\DYLTSWCH.EXE
  32. to your CONFIG.SYS file. Including a SET statement for the TZ environment variable could prove to be a useful mnemonic, too.
  33. What If It Breaks?
  34. Any problems or suggestions can be reported to the program's author, David W. Noon, via either of two means:
  35. CompuServe:    72172,431 (Internet: 72172.431@compuserve.com)
  36. FidoNet:    David Noon 1:109/347
  37. Now you can be asleep at 2:00 AM and still have your computer's clock changed on time!
  38. Switching To/From Daylight Saving Time
  39. Copyright (C) 1995 David W. Noon
  40. All rights reserved    Page 
  41. VariableDescriptionDefault
  42. SSSStandard time zone identifier. This must be 3 characters, must begin with a letter and can contain spaces.EST
  43. nDifference, in hours, between the standard time zone and Coordinated Universal Time (CUT), formerly known as Greenwich Mean Time (GMT). A positive number denotes a time zone west of Greenwich and a negative number denotes a time zone east of Greenwich.+5
  44. DDDDaylight Saving Time (DST) time zone identifier.
  45.  This must be 3 characters, must begin with a letter and can contain spaces.EDT
  46. smStarting month (1 to 12) of DST.4
  47. swStarting week (-4 to +4) of DST.1
  48. sdStarting day of DST.
  49. 1 to 31 if sw = 0
  50. 0 to 6 if sw 
  51. stStarting time (in seconds from midnight) of DST.3600
  52. emEnding month (1 to 12) of DST.10
  53. ewEnding week (-4 to +4)-1
  54. edEnding day of DST.
  55. 1 to 31 if ew = 0
  56. 0 to 6 if ew 
  57. etEnding time (in seconds from midnight) of DST.7200
  58. shiftAmount of time change (in seconds)3600
  59. Palatino Bold
  60. Palatino Roman
  61. Palatino Roman
  62. Times Bold
  63. Courier
  64. Courier Bold
  65. Courier
  66. Roman
  67. Helvetica
  68.