User Tools

Site Tools


cdc:nos2.source:nam5871:dluptm

DLUPTM

Table Of Contents

  • [00003] PROC DLUPTM(CLOCK$TIME,ELAPSED, RETRN)

Source Code

DLUPTM.txt
  1. *DECK DLUPTM
  2. USETEXT DLFPDEF
  3. PROC DLUPTM(CLOCK$TIME,ELAPSED, RETRN);# CALCULATE CLOCK TIME FROM OFFS#
  4. *IF DEF,IMS
  5. #
  6. *1DC DLUPTM
  7. *
  8. * 1. PROC NAME AUTHOR DATE
  9. * DLUPTM P.C.TAM 78/10/05
  10. *
  11. * 2. FUNCTIONAL DESCRIPTION.
  12. * CALCULATE CLOCK TIME.
  13. *
  14. * 3. METHOD USED.
  15. * CONVERT DISPLAY CLOCK TIME TO BINARY,
  16. * ADD IN ELAPSED TIME,
  17. * CONVERT BACK TO DISPLAY.
  18. *
  19. * 4. ENTRY PARAMETERS.
  20. * CLOCK$TIME CLOCK TIME IN DISPLAY CODE
  21. * ELAPSED OFFSET ADDED
  22. *
  23. * 5. EXIT PARAMETERS.
  24. * RETRN CALCULATED CLOCK TIME
  25. *
  26. * 6. COMDECKS CALLED AND SYMPL TEXTS USED.
  27. * DLFPDEF
  28. *
  29. * 7. ROUTINES CALLED.
  30. * NONE.
  31. *
  32.  #
  33. *ENDIF
  34. #
  35.   EXTERNAL VARIABLES
  36. #
  37. #
  38.   INTERNAL VARIABLES
  39. #
  40. ARRAY CLOCK$TIME S(1);
  41. BEGIN
  42. ITEM HOUR U(0,6,12); # HOUR FIELD #
  43. ITEM HOUR1 U(0,6,CL); # 1ST DIGIT OF HOUR FIELD #
  44. ITEM HOUR2 U(0,12,CL); # 2ND DIGIT OF HOUR FIELD #
  45. ITEM MINUTE U(0,24,12); # MINUTE FIELD #
  46. ITEM MIN1 U(0,24,CL); # 1ST DIGIT OF MINUTE FIELD #
  47. ITEM MIN2 U(0,30,CL); # 2ND DIGIT OF MINUTE FILED #
  48. ITEM SECS U(0,42,12); # SECONDS FIELD #
  49. ITEM SEC1 U(0,42,CL); # 1ST DIGIT OF SECOND FIELD #
  50. ITEM SEC2 U(0,48,CL); # 2ND DIGIT OF SECOND FIELD #
  51. END
  52.  
  53. ITEM
  54. ELAPSED I, # OFFSET TO ADD #
  55. RETRN C(WC), # RETURN RESULT #
  56. HH I, # TEMP VARIABLE TO HOLD HOUR FIELD #
  57. MM I, # TEMP VARIABLE TO HOLD MINUTE FIELD #
  58. SS I, # TEMP VARIABLE TO HOLD SECOND FIELD #
  59. TEMP1 I, # TEMPORARY VARIABLE #
  60. TEMP2 I; # TEMPORARY VARIABLE #
  61.  
  62. # ******************************************************************** #
  63.  
  64. BEGIN
  65. #
  66.   CALCULATE BINARY HOUR, MINUTE, SECOND.
  67. #
  68. HH = 10 * (HOUR1[0] - O"33") + (HOUR2[0] - O"33");
  69. MM = 10 * (MIN1[0] - O"33") + (MIN2[0] - O"33");
  70. SS = 10 * (SEC1[0] - O"33") + (SEC2[0] - O"33");
  71. #
  72.   ADD IN OFFSET
  73. #
  74. TEMP1 = SS + ELAPSED;
  75. TEMP2 = TEMP1 / 60;
  76. SS = TEMP1 - TEMP2 * 60;
  77. TEMP1 = MM + TEMP2;
  78. TEMP2 = TEMP1 / 60;
  79. MM = TEMP1 - TEMP2 * 60;
  80. TEMP1 = HH + TEMP2;
  81. TEMP2 = TEMP1 / 24;
  82. HH = TEMP1 - TEMP2 * 24;
  83. #
  84.   CONVERT TO DISPLAY CODE
  85. #
  86. RETRN = " . . .";
  87. TEMP1 = HH / 10;
  88. B<0, CL> RETRN = TEMP1 + O"33";
  89. B<6, CL> RETRN = (HH - TEMP1 * 10) + O"33";
  90. TEMP1 = MM / 10;
  91. B<18, CL> RETRN = TEMP1 + O"33";
  92. B<24, CL> RETRN = (MM - TEMP1 * 10) + O"33";
  93. TEMP1 = SS / 10;
  94. B<36, CL> RETRN = TEMP1 + O"33";
  95. B<42, CL> RETRN = (SS - TEMP1 * 10) + O"33";
  96. END
  97. TERM
cdc/nos2.source/nam5871/dluptm.txt ยท Last modified: 2023/08/05 17:22 by Site Administrator