clkdll.pas 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. {
  2. Copyright (c) 2002 by Mark Eckstein
  3. Copyright (c) 2003 by Yuri Prokushev ([email protected])
  4. eCS Clock API (part of standard eCS installation)
  5. This program is free software; you can redistribute it and/or modify it
  6. under the terms of the GNU Library General Public License (LGPL) as
  7. published by the Free Software Foundation; either version 2 of the
  8. License, or (at your option) any later version. This program is
  9. distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. FITNESS FOR A PARTICULAR PURPOSE.
  12. See the GNU Library General Public License for more details. You should
  13. have received a copy of the GNU Library General Public License along
  14. with this program; if not, write to the Free Software Foundation, Inc.,
  15. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. 1 **********************************************************************}
  17. {
  18. The Clock API is a set of functions, which offer you a variety of
  19. time-related operations. You can use it like any other DLL provided
  20. with OS/2 and eComStation. However, the Clock API DLL is not Rexx
  21. enabled.
  22. }
  23. {$IFNDEF FPC_DOTTEDUNITS}
  24. Unit clkdll;
  25. {$ENDIF FPC_DOTTEDUNITS}
  26. Interface
  27. {$IFDEF FPC_DOTTEDUNITS}
  28. Uses
  29. OS2Api.doscalls;
  30. {$ELSE FPC_DOTTEDUNITS}
  31. Uses
  32. DosCalls;
  33. {$ENDIF FPC_DOTTEDUNITS}
  34. {
  35. If you need to know the universal world time call this API. The
  36. value it returns is updated every 250 ms, so it's rather meant
  37. for not-too-high precision tasks.
  38. Return values: 0 ... ok
  39. 128 ... failed
  40. }
  41. Function ClkQueryUTC(var Value: TDateTime): Cardinal; cdecl;
  42. external 'clkdll' name 'ClkQueryUTC'; {index 00001}
  43. {
  44. You can obtain the time zone offset using this API.
  45. Return values: 0 ... ok
  46. 128 ... failed
  47. }
  48. Function ClkQueryUTCOffset(var Value: Longint): Cardinal; cdecl;
  49. external 'clkdll' name 'ClkQueryUTCOffset'; {index 00002}
  50. {
  51. Get the difference between standard time and summer time in
  52. seconds by calling this API.
  53. Return values: 0 ... ok
  54. 128 ... failed
  55. }
  56. Function ClkQueryDSTAdvance(var Value: Integer): Cardinal; cdecl;
  57. external 'clkdll' name 'ClkQueryDSTAdvance'; {index 00003}
  58. {
  59. This returns the standard time zone identifier and date and
  60. time of the next change to standard time.
  61. Return values: 0 ... ok
  62. 30 ... ID only
  63. 40 ... Date only
  64. 128 ... failed
  65. }
  66. Function ClkQuerySTData(ID: PAnsiChar; var NextDate: TDateTime): Cardinal; cdecl;
  67. external 'clkdll' name 'ClkQuerySTData'; {index 00004}
  68. {
  69. This returns the summer time zone identifier and date and
  70. time of the next change to summer time.
  71. Return values: 0 ... ok
  72. 30 ... ID only
  73. 40 ... Date only
  74. 128 ... failed
  75. }
  76. Function ClkQueryDSTData(ID: PAnsiChar; var NextDate: TDateTime): Cardinal; cdecl;
  77. external 'clkdll' name 'ClkQueryDSTData'; {index 00005}
  78. {
  79. This returns the TZ string that is currently in use, independent
  80. from the actual TZ environment setting.
  81. Return values: 0 ... ok
  82. 128 ... failed
  83. }
  84. Function ClkQueryTimeZone(value: PAnsiChar): Cardinal; cdecl;
  85. external 'clkdll' name 'ClkQueryTimeZone'; {index 00006}
  86. {
  87. If you want to know in which hemisphere the computer is located
  88. call this API.
  89. Value is either 0 for southern or 1 for northern hemisphere.
  90. Return values: 0 ... ok
  91. 128 ... failed
  92. }
  93. Function ClkQueryHemisphere(var Value: Integer): Cardinal; cdecl;
  94. external 'clkdll' name 'ClkQueryHemisphere'; {index 00007}
  95. {
  96. The system's uptime is returned when calling this API. Opposed
  97. to the OS/2 API for the same purpose this one's rollover will
  98. be after approximately 130 years (untested!).
  99. Return values: 0 ... ok
  100. 128 ... failed
  101. }
  102. Function ClkQueryUptime(var Days, Hours, Minutes, Seconds, Hundredths: Cardinal): Cardinal; cdecl;
  103. external 'clkdll' name 'ClkQueryUptime'; {index 00008}
  104. {
  105. Returns, whether a synchronization can be done (Value == 1) or
  106. not (Value == 0). This depends on the chosen connection type and
  107. the current connection status.
  108. Return values: 0 ... ok
  109. 128 ... failed
  110. }
  111. Function ClkCanSynchronize(var Value: Integer): Cardinal; cdecl;
  112. external 'clkdll' name 'ClkCanSynchronize'; {index 00015}
  113. {
  114. Triggers a time synchronization.
  115. Return values: 0 ... ok
  116. 64 ... writing to pipe failed
  117. 70 ... can't synchronize
  118. 128 ... clkbasic version could not be determined
  119. 129 ... clkbasic version unknow
  120. }
  121. Function ClkDoSynchronize: Cardinal; cdecl;
  122. external 'clkdll' name 'ClkDoSynchronize'; {index 00013}
  123. {
  124. Queries, whether clkbasic is currently in the process of
  125. synchronizing (Value == 1: yes, Value == 0: no)
  126. Return values: 0 ... ok
  127. 128 ... failed
  128. }
  129. Function ClkIsSynchronizing(var Value: Integer): Cardinal; cdecl;
  130. external 'clkdll' name 'ClkIsSynchronizing'; {index 00014}
  131. {
  132. Returns the synchronization data. Date and time of the last
  133. attempted synchronization, date and time of the last successful
  134. synchronization, indicator for success of last attempt and the host
  135. from where the time could be synched successfully.
  136. Return values: 0 ... ok
  137. 128 ... failed
  138. }
  139. Function ClkGetSynchData(var Last, LastSuccess: TDateTime;
  140. var LastWasSuccessful: Integer;
  141. LastSuccessfulHost: PAnsiChar): Cardinal; cdecl;
  142. external 'clkdll' name 'ClkGetSynchData'; {index 00016}
  143. { not documented
  144. external 'clkdll' name 'ClkQueryBasePath'; {index 00009}
  145. external 'clkdll' name 'ClkQueryLanguagePath'; {index 00010}
  146. external 'clkdll' name 'ClkQueryDialupState'; {index 00011}
  147. external 'clkdll' name 'ClkQueryVersion'; {index 00012}
  148. external 'clkdll' name 'ClkCallSettings'; {index 00017}
  149. external 'clkdll' name 'ClkCallSchedulerHelper'; {index 00018}
  150. }
  151. Implementation
  152. End.