home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / xc212os2.zip / DEF / timeconv.def < prev   
Text File  |  1993-08-27  |  3KB  |  99 lines

  1. (* (c) xTech 1992,93. All Rights Reserved *)
  2. DEFINITION MODULE TimeConv; 
  3.  
  4. IMPORT  SysClock;
  5.  
  6. TYPE DateTime = SysClock.DateTime;
  7.  
  8. PROCEDURE Compare(dl,dr: DateTime): INTEGER;
  9. (* if "dl" or "dr" is invalid, returns 0;
  10.    returns value <0 if "dl" is before than "dr";
  11.    returns value >0 if "dl" is after  than "dr";
  12.    returns 0 if "dl" is equal to  "dr";
  13. *)
  14.  
  15. PROCEDURE SubDateDays(dl,dr: DateTime): CARDINAL;
  16. (*
  17.    returns number of days passed from "dr" to "dr";
  18.    if one of dates is invalid or if "dl" is before than "dr"
  19.    returns 0
  20. *)
  21.  
  22. PROCEDURE SubDateSecs(dl,dr: DateTime): CARDINAL;
  23. (*
  24.    returns number of seconds passed from "dr" to "dr";
  25.    if one of dates is invalid or if "dl" is before than "dr"
  26.    returns 0
  27. *)
  28.  
  29. PROCEDURE AddDateDays(d: DateTime; days: CARDINAL; VAR res: DateTime);
  30. (*
  31.   add "days" days to date "d" and assignes resulting date
  32.   description to "res";
  33.   IF "d" is invalid, "res" will be assigned to first valid date
  34. *)
  35.  
  36. PROCEDURE AddDateSecs(d: DateTime; secs: CARDINAL; VAR res: DateTime);
  37. (*
  38.   add "secs" seconds to date "d" and assignes resulting date
  39.   description to "res";
  40.   IF "d" is invalid, "res" will be assigned to first valid date
  41. *)
  42.  
  43. PROCEDURE TheDayNumber     (d: DateTime): CARDINAL;
  44. (*
  45.   returns the ordinal number of the day for valid date "d";
  46.   if "d" is invalid, returns 0
  47. *)
  48.  
  49. PROCEDURE TheFractionNumber(d: DateTime): CARDINAL;
  50. (*
  51.   returns number fractions passed from time 0:00:00.00
  52.   of the day for valid date "d";
  53.   if "d" is invalid, returns 0
  54. *)
  55.  
  56. PROCEDURE WeekDay(d: DateTime): CARDINAL;
  57. (*
  58.   returns week day for valid date "d":
  59.   0 - sunday, 1 - monday etc.
  60.   if "d" is invalid, returns 0
  61. *)
  62.  
  63. (*
  64.         Next procedures are system-dependent.
  65. *)
  66.  
  67. PROCEDURE millisecs(): CARDINAL;
  68. (*
  69.   returns number of miliseconds passed from
  70.   the time 0:00:00.00 of current date as known to system
  71. *)
  72.  
  73. PROCEDURE time(): CARDINAL;
  74. (*
  75.   returns number of seconds passed from the time
  76.   0:00:00.00 at first valid date for the system
  77. *)
  78.  
  79. PROCEDURE unpack(VAR d: DateTime;     secs: CARDINAL);
  80. (*
  81.   assigns to "d" value corresponding to date/time for "secs"
  82.   seconds later than starting time/date for the system;
  83.   This procedure can be used to examine the first system time/date:
  84.     unpack(firstDateTime,0);
  85. *)
  86.  
  87. PROCEDURE pack  (    d: DateTime; VAR secs: CARDINAL);
  88. (*
  89.   the effect is opposit to the procedure "unpack"
  90. *)
  91.  
  92. PROCEDURE weekday(t: CARDINAL): CARDINAL;
  93. (*
  94.   equal to calls
  95.     unpack(tmpDateTime,t); RETURN WeekDay(tmpDateTime);
  96. *)
  97.  
  98. END TimeConv.
  99.