home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / datetime / navytime / navytime.nw < prev    next >
Encoding:
Text File  |  1987-08-15  |  8.1 KB  |  199 lines

  1. .heNAVYTIME -- Get Date/Time from Naval Observatory    Page #
  2. Copyrigh⌠ 198╖  Michae∞ ═ Rubenstein
  3.  
  4. Thi≤ softwarσ ma∙ bσ freel∙ distributeΣ a≤ lonτ a≤ n∩ feσ i≤ ì
  5. assesseΣ anΣ thσ copyrigh⌠ noticσ i≤ retained.
  6.  
  7. Thσ function≤ containeΣ iε COMM.C¼ TIMER.C¼ ATFINISH.C¼ anΣ ì
  8. SETTZ.├ ma∙ bσ distributeΣ a≤ par⌠ oµ aε executablσ prograφ ì
  9. (eveε iµ ß feσ i≤ charged⌐ provideΣ thσ followinτ copyrigh⌠ ì
  10. noticσ i≤ included:
  11.  
  12.      Portion≤ copyrigΦ⌠ 198╖  Michae∞ ═ Rubensteiε
  13.  
  14.  
  15. Change≤ iε Versioε 1.1.
  16.  
  17. .RR--!-!-------!----!----!----!----!----!----!----!----!--------R
  18. .lm 6
  19.      ¡ Thσ interrup⌠ servicσ routinσ fo≥ thσ time≥ ha≤ beeε ì
  20. ááááááárewritteε t∩ reducσ thσ stacδ spacσ required«  Thσ ì
  21. ááááááámodificatioε i≤ baseΣ oε ß routinσ b∙ Doε Corbitt.
  22.  
  23. ááááá- Thσ RS23▓ interfacσ i≤ cleareΣ afte≥ dialing«  Thi≤ ì
  24. áááááááprevent≤ olΣ message≤ froφ abortinτ thσ transfer.
  25.  
  26. ááááá- Define≤ fo≥ TRU┼ anΣ FALS┼ havσ beeε inserteΣ s∩ thσ ì
  27. ááááááástandarΣ Turb∩ ├ includσ file≤ ma∙ bσ useΣ (thσ origina∞ ì
  28. ááááááárequireΣ m∙ modifieΣ STDIO.H.
  29.  
  30. ááááá- Thσ filσ BUILTINS.MA╦ i≤ no≈ included«  Thi≤ i≤ requireΣ ì
  31. áááááááfo≥ thσ makefilσ t∩ work.
  32.  
  33. ááááá- Thσ documentatioε no≈ mention≤ tha⌠ getopt (distributeΣ ì
  34. áááááááwitΦ Turbo ├ iε sourcσ forφ only⌐ i≤ requireΣ anΣ ì
  35. ááááááádiscusse≤ thσ implication≤ (thσ compileΣ versioε use≤ ß ì
  36. áááááááprivatσ versioε oµ getopt whicΦ doe≤ no⌠ respec⌠ thσ ì
  37. áááááááswitcΦ characte≥ a≤ doe≤ thσ onσ iε thσ Turb∩ ├ ì
  38. ááááááádistribution.
  39. .lm1
  40.  
  41.  
  42. Description.
  43.  
  44. NAVYTIM┼ call≤ thσ 120░ bauΣ Nava∞ Observator∙ timσ servicσ fo≥ ì
  45. digita∞ clock≤ a⌠ (202⌐ 65│-035▒ anΣ set≤ thσ systeφ time«  ì
  46. Becausσ oµ delay≤ iε thσ phonσ system¼ thσ timσ ma∙ bσ ofµ b∙ a≤ ì
  47. mucΦ a≤ .╡ second.
  48.  
  49.  
  50. Installation.
  51.  
  52. Beforσ usinτ NAVYTIM┼ certaiε thing≤ havσ t∩ bσ se⌠ up«  Thσ ì
  53. prograφ mus⌠ kno≈ thσ timσ zonσ anΣ whethe≥ dayligh⌠ saving≤ timσ ì
  54. i≤ used«  Thi≤ i≤ donσ b∙ settinτ aε environmen⌠ variablσ T┌ witΦ ì
  55. thσ command
  56.  
  57.      se⌠ TZ=xxxnyyy
  58.  
  59. wherσ xx° anΣ yy∙ arσ an∙ letter≤ anΣ ε i≤ thσ numbe≥ oµ hour≤ ìèbehinΣ GreenwicΦ Meaε timσ fo≥ standarΣ time«  Iµ yy∙ i≤ omitted¼ ì
  60. thσ NAVYTIM┼ assume≤ tha⌠ dayligh⌠ saving≤ timσ i≤ NO╘ used«  xx° ì
  61. anΣ yy∙ arσ intendeΣ t∩ bσ thσ abbreviatioε fo≥ thσ timσ useΣ ì
  62. (xx° fo≥ standarΣ time¼ yy∙ fo≥ dayligh⌠ saving≤ time).
  63.  
  64. Fo≥ example¼ iµ thσ areß yo⌡ arσ iε use≤ Easterε Standard/Easterε ì
  65. Dayligh⌠ time¼ thσ commanΣ woulΣ be
  66.  
  67.      se⌠ TZ=EST5DST
  68.  
  69. (Easterε StandarΣ i≤ ╡ hour≤ behinΣ GMT)«  Iµ Easterε StandarΣ i≤ ì
  70. useΣ throughou⌠ thσ year¼ thσ commanΣ woulΣ be
  71.  
  72.      se⌠ TZ=EST5
  73.  
  74. Notσ tha⌠ thσ numbe≥ oµ hour≤ behinΣ GM╘ ma∙ bσ morσ thaε onσ ì
  75. digi⌠ (iε thσ Pacific⌐ o≥ ma∙ bσ negativσ (iε mos⌠ oµ Europe¼ ì
  76. Africa¼ anΣ Asia)«  Thσ program¼ however¼ determine≤ iµ Dayligh⌠ ì
  77. saving≤ timσ i≤ iε effec⌠ baseΣ oε thσ UniteΣ State≤ conventions«  ì
  78.  
  79. I⌠ wil∞ als∩ bσ necessar∙ t∩ modif∙ thσ thσ configuratioε file¼ ì
  80. NAVYTIME.RC«  User≤ no⌠ iε thσ Washingtoε D├ loca∞ callinτ areß ì
  81. wil∞ havσ t∩ changσ thσ phonσ numbe≥ oε thσ seconΣ linσ t∩ ì
  82. includσ thσ areß code«  Iµ you≥ modeφ i≤ no⌠ oε COM▒ o≥ i≤ no⌠ ì
  83. compatiblσ witΦ thσ Haye≤ 120░¼ othe≥ change≤ wil∞ bσ required.
  84.  
  85. Thσ configuratioε filσ ha≤ ß rathe≥ inflexiblσ format«  EacΦ linσ ì
  86. ha≤ ß specifiπ meaning«  I⌠ i≤ importan⌠ tha⌠ therσ bσ n∩ space≤ ì
  87. a⌠ thσ end≤ oµ line≤«  Thσ line≤ havσ thσ followinτ meanings
  88.  
  89. .RR--!---------!----!----!----!----!----!----!----!----!--------R
  90.      Line      Meaning
  91.      ----      -------------------------------------------------
  92. .RR------#-----!----!-!--!----!----!----!----!----!----!--------R
  93.         1      Thσ CO═ por⌠ t∩ use«  Onl∙ ▒ anΣ ▓ arσ supported.
  94.  
  95.         2      Thσ commanΣ t∩ initializσ thσ modeφ anΣ dial«  I⌠ ì
  96. áááááááááááááááconsist≤ oµ an∙ combinatioε oµ thσ following
  97.  
  98. .lm21
  99.                     - String≤ iε quote≤ whicΦ arσ sen⌠ t∩ thσ ì
  100. áááááááááááááááááááááámodeφ verbatim.
  101.  
  102. áááááááááááááááááááá- Pair≤ oµ thσ forφ ^° wherσ ° i≤ an∙ ì
  103. ááááááááááááááááááááááprintinτ characte≥ whicΦ result≤ iε thσ ì
  104. áááááááááááááááááááááácontro∞ characte≥ correspondinτ t∩ ° t∩ bσ ì
  105. áááááááááááááááááááááásent«  Fo≥ example¼ t∩ senΣ ß carriagσ ì
  106. ááááááááááááááááááááááreturn¼ includσ thσ pair
  107.  
  108. áááááááááááááááááááá          ^m
  109.  
  110. áááááááááááááááááááá- Integer≤ whicΦ specif∙ ß dela∙ iε tenth≤ oµ ì
  111. ááááááááááááááááááááááß second«  T∩ pausσ onσ seconΣ includσ thσ ì
  112. ááááááááááááááááááááááintege≥ 10«  Number≤ large≥ thaε 360░ (iµ ì
  113. ááááááááááááááááááááááyou≥ modeφ need≤ ß dela∙ an∙ wherσ closσ t∩ ì
  114. ááááááááááááááááááááááthat¼ yo⌡ havσ m∙ deepes⌠ sympathy⌐ wil∞ ì
  115. ááááááááááááááááááááááno⌠ worδ properly.
  116. èáááááááááááááááááááá- An∙ othe≥ characters¼ typicall∙ spaces¼ ì
  117. ááááááááááááááááááááááwhicΦ arσ ignored.
  118.  
  119. .lm1
  120.         3      Thσ commanΣ t∩ senΣ t∩ terminatσ ß call«  Thi≤ ì
  121. ááááááááááááááálinσ ma∙ bσ empt∙ iµ thσ modeφ i≤ configureΣ t∩ ì
  122. ááááááááááááááádisconnec⌠ wheε DT╥ i≤ dropped.
  123.  
  124.         4      Thσ strinτ t∩ matcΦ t∩ recognizσ establishmen⌠ oµ ì
  125. áááááááááááááááß connection«  Thσ modeφ mus⌠ senΣ ß connectioε ì
  126. ááááááááááááááámessagσ terminateΣ b∙ ß carriagσ returε o≥ linσ ì
  127. áááááááááááááááfeed«  ┴ messagσ containinτ thi≤ strinτ iε an∙ ì
  128. ááááááááááááááápositioε (fo≥ example¼ NNEC wil∞ matcΦ CONNECT⌐ ì
  129. áááááááááááááááwil∞ bσ takeε a≤ indicatinτ tha⌠ thσ connectioε i≤ ì
  130. ááááááááááááááácomplete«  Uppe≥ anΣ lowe≥ casσ letter≤ arσ ì
  131. áááááááááááááááconsidereΣ different.
  132.  
  133.      4-19      U≡ t∩ 1╡ string≤ t∩ matcΦ t∩ recognizσ failurσ t∩ ì
  134. ááááááááááááááámakσ ß connection«  Thesσ arσ matcheΣ iε thσ samσ ì
  135. áááááááááááááááwa∙ a≤ thσ connec⌠ string.
  136.  
  137. .RR--!----!----!----!----!----!----!----!----!----!----!--------R
  138. Aε alternatσ configuratioε filσ fo≥ thσ Raca∞ Vadiπ 2400╓ (anΣ ì
  139. possibl∙ othe≥ Raca∞ Vadic⌐ modem≤ i≤ includeΣ a≤ NAVYTIME.RV«  ì
  140.  
  141. Finally¼ i⌠ i≤ necessar∙ t∩ inforφ thσ prograφ wherσ thσ ì
  142. configuratioε filσ wil∞ bσ found«  Normally¼ i⌠ assume≤ tha⌠ thσ ì
  143. configuratioε filσ wil∞ bσ C:\ETC\NAVYTIME.RC«  Iµ thi≤ i≤ no⌠ ì
  144. convenient¼ se⌠ thσ environmen⌠ variablσ NAVYTIM┼ t∩ thσ ful∞ ì
  145. namσ oµ thσ configuratioε file«  Fo≥ example¼ iµ thσ filσ wil∞ bσ ì
  146. D:\CONFIG\NAVYTIME.CFG¼ usσ thσ command
  147.  
  148.      se⌠ NAVYTIME=d:\config\navytime.cfg
  149.  
  150.  
  151.  
  152. Usinτ NAVYTIME.
  153.  
  154. Iµ invokeΣ witΦ n∩ parameters¼ NAVYTIM┼ wil∞ cal∞ thσ timσ ì
  155. servicσ anΣ se⌠ thσ DO╙ time¼ displayinτ n∩ message≤ iµ ì
  156. successful«  Iµ thσ commanΣ linσ paramete≥ -÷ i≤ given¼ thσ timσ ì
  157. wil∞ bσ displayed«  Iµ thσ paramete≥ -v÷ i≤ given¼ modeφ message≤ ì
  158. wil∞ als∩ bσ displayed.
  159.  
  160. NAVYTIM┼ doe≤ no⌠ se⌠ ß batter∙ backeΣ u≡ clocδ unles≤ thi≤ i≤ ì
  161. donσ b∙ MSDO╙ wheε thσ DO╙ timσ i≤ set«  T∩ se⌠ ß batter∙ backeΣ ì
  162. u≡ clock¼ invokσ NAVYTIM┼ witΦ ß batcΦ filσ include≤ ß commanΣ t∩ ì
  163. se⌠ thσ batter∙ clocδ froφ thσ MSDO╙ time.
  164.  
  165.  
  166.  
  167. Fo≥ thσ Hacker.
  168.  
  169. NAVYTIM┼ i≤ writteε iε Turb∩ C«  Sincσ onσ oµ thσ reason≤ fo≥ ì
  170. writinτ thi≤ prograφ wa≤ t∩ evaluatσ Turb∩ C¼ n∩ attemp⌠ wa≤ madσ ì
  171. t∩ kee≡ compatibilit∙ witΦ othe≥ version≤ oµ C«  Mos⌠ othe≥ ├ ì
  172. compiler≤ wil∞ havσ difficult∙ witΦ thσ prototypσ declaration≤ ìèanΣ thσ inlinσ assembl∙ codσ oµ comm.c.
  173.  
  174. Thσ functioε getop⌠ i≤ used«  Thi≤ functioε i≤ includeΣ witΦ ì
  175. Turb∩ ├ iε sourcσ forφ only«  Iµ generatinτ NAVYTIME.EXE¼ thi≤ ì
  176. functioε mus⌠ bσ includeΣ iε CS.LI┬ o≥ thσ makefilσ mus⌠ bσ ì
  177. modifieΣ t∩ compilσ anΣ linδ getop⌠.obj.
  178.  
  179. Fou≥ files¼ COMM.C¼ TIMER.C¼ ATFINISH.C¼ anΣ SETTZ.├ wil∞ bσ oµ ì
  180. genera∞ interes⌠ t∩ Turb∩ ├ programmers.
  181.  
  182. COMM.├ implement≤ simplσ interrup⌠ driveε output¼ polleΣ inpu⌠ t∩ ì
  183. COM▒ anΣ COM2«  Thσ maiε limitation≤ arσ n∩ checkinτ fo≥ parit∙ ì
  184. o≥ othe≥ error≤ anΣ flo≈ contro∞ i≤ no⌠ implemented.
  185.  
  186. TIMER.├ i≤ ß simplσ stopwatcΦ timer«  Becausσ oµ MSDO╙ ì
  187. limitations¼ time≥ completioε mus⌠ bσ polleΣ witΦ chk_timer().
  188.  
  189. ATFINIS╚ i≤ simila≥ t∩ thσ librar∙ functioε ATEXI╘ excep⌠ tha⌠ ì
  190. thσ registereΣ functioε wil∞ alway≤ bσ executeΣ wheε thσ prograφ ì
  191. terminate≤ (ATEXI╘ function≤ arσ executeΣ onl∙ oε norma∞ ì
  192. termination)«  U≡ t∩ ╕ function≤ ma∙ bσ registered.
  193.  
  194. SETT┌ set≤ thσ timσ zonσ froφ informatioε iε thσ DO╙ environment«  ì
  195.  
  196. Thesσ function≤ ma∙ bσ useΣ fo≥ botΦ freσ anΣ commercia∞ ì
  197. distributioε provideΣ m∙ copyrigh⌠ noticσ i≤ included«  ì
  198. Commercia∞ distribution≤ ma∙ no⌠ includσ sourcσ o≥ relocatables.
  199.