clkdll.pas 5.7 KB

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