clkdll.pas 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. Unit clkdll;
  24. Interface
  25. Uses
  26. DosCalls;
  27. {
  28. If you need to know the universal world time call this API. The
  29. value it returns is updated every 250 ms, so it's rather meant
  30. for not-too-high precision tasks.
  31. Return values: 0 ... ok
  32. 128 ... failed
  33. }
  34. Function ClkQueryUTC(var Value: TDateTime): Cardinal; cdecl;
  35. external 'clkdll' name 'ClkQueryUTC'; {index 00001}
  36. {
  37. You can obtain the time zone offset using this API.
  38. Return values: 0 ... ok
  39. 128 ... failed
  40. }
  41. Function ClkQueryUTCOffset(var Value: Longint): Cardinal; cdecl;
  42. external 'clkdll' name 'ClkQueryUTCOffset'; {index 00002}
  43. {
  44. Get the difference between standard time and summer time in
  45. seconds by calling this API.
  46. Return values: 0 ... ok
  47. 128 ... failed
  48. }
  49. Function ClkQueryDSTAdvance(var Value: Integer): Cardinal; cdecl;
  50. external 'clkdll' name 'ClkQueryDSTAdvance'; {index 00003}
  51. {
  52. This returns the standard time zone identifier and date and
  53. time of the next change to standard time.
  54. Return values: 0 ... ok
  55. 30 ... ID only
  56. 40 ... Date only
  57. 128 ... failed
  58. }
  59. Function ClkQuerySTData(ID: PChar; var NextDate: TDateTime): Cardinal; cdecl;
  60. external 'clkdll' name 'ClkQuerySTData'; {index 00004}
  61. {
  62. This returns the summer time zone identifier and date and
  63. time of the next change to summer time.
  64. Return values: 0 ... ok
  65. 30 ... ID only
  66. 40 ... Date only
  67. 128 ... failed
  68. }
  69. Function ClkQueryDSTData(ID: PChar; var NextDate: TDateTime): Cardinal; cdecl;
  70. external 'clkdll' name 'ClkQueryDSTData'; {index 00005}
  71. {
  72. This returns the TZ string that is currently in use, independent
  73. from the actual TZ environment setting.
  74. Return values: 0 ... ok
  75. 128 ... failed
  76. }
  77. Function ClkQueryTimeZone(value: PChar): Cardinal; cdecl;
  78. external 'clkdll' name 'ClkQueryTimeZone'; {index 00006}
  79. {
  80. If you want to know in which hemisphere the computer is located
  81. call this API.
  82. Value is either 0 for southern or 1 for northern hemisphere.
  83. Return values: 0 ... ok
  84. 128 ... failed
  85. }
  86. Function ClkQueryHemisphere(var Value: Integer): Cardinal; cdecl;
  87. external 'clkdll' name 'ClkQueryHemisphere'; {index 00007}
  88. {
  89. The system's uptime is returned when calling this API. Opposed
  90. to the OS/2 API for the same purpose this one's rollover will
  91. be after approximately 130 years (untested!).
  92. Return values: 0 ... ok
  93. 128 ... failed
  94. }
  95. Function ClkQueryUptime(var Days, Hours, Minutes, Seconds, Hundredths: Cardinal): Cardinal; cdecl;
  96. external 'clkdll' name 'ClkQueryUptime'; {index 00008}
  97. {
  98. Returns, whether a synchronization can be done (Value == 1) or
  99. not (Value == 0). This depends on the chosen connection type and
  100. the current connection status.
  101. Return values: 0 ... ok
  102. 128 ... failed
  103. }
  104. Function ClkCanSynchronize(var Value: Integer): Cardinal; cdecl;
  105. external 'clkdll' name 'ClkCanSynchronize'; {index 00015}
  106. {
  107. Triggers a time synchronization.
  108. Return values: 0 ... ok
  109. 64 ... writing to pipe failed
  110. 70 ... can't synchronize
  111. 128 ... clkbasic version could not be determined
  112. 129 ... clkbasic version unknow
  113. }
  114. Function ClkDoSynchronize: Cardinal; cdecl;
  115. external 'clkdll' name 'ClkDoSynchronize'; {index 00013}
  116. {
  117. Queries, whether clkbasic is currently in the process of
  118. synchronizing (Value == 1: yes, Value == 0: no)
  119. Return values: 0 ... ok
  120. 128 ... failed
  121. }
  122. Function ClkIsSynchronizing(var Value: Integer): Cardinal; cdecl;
  123. external 'clkdll' name 'ClkIsSynchronizing'; {index 00014}
  124. {
  125. Returns the synchronization data. Date and time of the last
  126. attempted synchronization, date and time of the last successful
  127. synchronization, indicator for success of last attempt and the host
  128. from where the time could be synched successfully.
  129. Return values: 0 ... ok
  130. 128 ... failed
  131. }
  132. Function ClkGetSynchData(var Last, LastSuccess: TDateTime;
  133. var LastWasSuccessful: Integer;
  134. LastSuccessfulHost: PChar): Cardinal; cdecl;
  135. external 'clkdll' name 'ClkGetSynchData'; {index 00016}
  136. { not documented
  137. external 'clkdll' name 'ClkQueryBasePath'; {index 00009}
  138. external 'clkdll' name 'ClkQueryLanguagePath'; {index 00010}
  139. external 'clkdll' name 'ClkQueryDialupState'; {index 00011}
  140. external 'clkdll' name 'ClkQueryVersion'; {index 00012}
  141. external 'clkdll' name 'ClkCallSettings'; {index 00017}
  142. external 'clkdll' name 'ClkCallSchedulerHelper'; {index 00018}
  143. }
  144. Implementation
  145. End.