home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_GEN / EDSV4064.ZIP / EPP-V1_1.ZIP / T.E < prev    next >
Text File  |  1993-06-26  |  2KB  |  64 lines

  1.  
  2.  
  3. /*---------------------------------------------------------------------*/
  4. /* Module systemTimeStr() function.  This is necessary for KS1.3 users */
  5. /* since we can't use the utilities.library, nor the DatetoStr()       */
  6. /* function of the newer OS.                                           */
  7. /*---------------------------------------------------------------------*/
  8.  
  9. MODULE 'dos/datetime', 'dos/dos'
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17. PROC exp (n, p)
  18.   /* Computes n**p. */
  19.   DEF i, x = 1
  20.   FOR i := 1 TO p DO x := x * n
  21. ENDPROC  x
  22.   /* exp */
  23.  
  24. PROC itoa (str, int)
  25.   StringF (str, '\d', int)
  26. ENDPROC  str
  27.  
  28. PROC buildTimeStr (theString, hour, minute, second)
  29.   DEF tempStr [2] : STRING
  30.   SetStr (theString, 0)
  31.   VOID itoa (tempStr, hour)
  32.   IF hour < 10 THEN StrAdd (theString, '0', ALL)
  33.   StrAdd (theString, tempStr, ALL)
  34.   StrAdd (theString, ':', ALL)
  35.  
  36.   VOID itoa (tempStr, minute)
  37.   IF minute < 10 THEN StrAdd (theString, '0', ALL)
  38.   StrAdd (theString, tempStr, ALL)
  39.   StrAdd (theString, ':', ALL)
  40.  
  41.   VOID itoa (tempStr, second)
  42.   IF second < 10 THEN StrAdd (theString, '0', ALL)
  43.   StrAdd (theString, tempStr, ALL)
  44. ENDPROC  theString
  45.   /* buildTimeStr */
  46.  
  47.  
  48. PROC systemTimeStr (theString)
  49.   DEF ds : PTR TO datestamp,
  50.       hour, minute, second
  51.   ds := DateStamp (New (SIZEOF datestamp))
  52.   hour := ds.minute / 60
  53.   minute := ds.minute - (hour * 60)
  54.   second := ds.tick / 50
  55.   Dispose (ds)
  56. ENDPROC  buildTimeStr (theString, hour, minute, second)
  57.   /* systemTimeStr */
  58.  
  59. PROC main ()
  60.   DEF systemTime [8] : STRING
  61.   VOID systemTimeStr (systemTime)
  62.   WriteF ('The current time is \s.\n', systemTime)
  63. ENDPROC