Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

207 lines
4.5 KiB

  1. /*
  2. File: UTCUtils.h
  3. Contains: Interface for UTC to Local Time conversion and 64 Bit Clock routines
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1999-2001 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __UTCUTILS__
  11. #define __UTCUTILS__
  12. #ifndef __MACTYPES__
  13. #include <MacTypes.h>
  14. #endif
  15. #ifndef __MACERRORS__
  16. #include <MacErrors.h>
  17. #endif
  18. #if PRAGMA_ONCE
  19. #pragma once
  20. #endif
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. #if PRAGMA_IMPORT
  25. #pragma import on
  26. #endif
  27. #if PRAGMA_STRUCT_ALIGN
  28. #pragma options align=mac68k
  29. #elif PRAGMA_STRUCT_PACKPUSH
  30. #pragma pack(push, 2)
  31. #elif PRAGMA_STRUCT_PACK
  32. #pragma pack(2)
  33. #endif
  34. /* Options for Set & Get DateTime Routines */
  35. enum {
  36. kUTCDefaultOptions = 0
  37. };
  38. /* 64 Bit Clock Typedefs */
  39. struct UTCDateTime {
  40. UInt16 highSeconds;
  41. UInt32 lowSeconds;
  42. UInt16 fraction;
  43. };
  44. typedef struct UTCDateTime UTCDateTime;
  45. typedef UTCDateTime * UTCDateTimePtr;
  46. typedef UTCDateTimePtr * UTCDateTimeHandle;
  47. struct LocalDateTime {
  48. UInt16 highSeconds;
  49. UInt32 lowSeconds;
  50. UInt16 fraction;
  51. };
  52. typedef struct LocalDateTime LocalDateTime;
  53. typedef LocalDateTime * LocalDateTimePtr;
  54. typedef LocalDateTimePtr * LocalDateTimeHandle;
  55. /* Classic 32 bit clock conversion routines */
  56. /*
  57. * ConvertLocalTimeToUTC()
  58. *
  59. * Availability:
  60. * Non-Carbon CFM: in UTCUtils 1.0 and later
  61. * CarbonLib: in CarbonLib 1.0.2 and later
  62. * Mac OS X: in version 10.0 and later
  63. */
  64. EXTERN_API_C( OSStatus )
  65. ConvertLocalTimeToUTC(
  66. UInt32 localSeconds,
  67. UInt32 * utcSeconds);
  68. /*
  69. * ConvertUTCToLocalTime()
  70. *
  71. * Availability:
  72. * Non-Carbon CFM: in UTCUtils 1.0 and later
  73. * CarbonLib: in CarbonLib 1.0.2 and later
  74. * Mac OS X: in version 10.0 and later
  75. */
  76. EXTERN_API_C( OSStatus )
  77. ConvertUTCToLocalTime(
  78. UInt32 utcSeconds,
  79. UInt32 * localSeconds);
  80. /* 64 bit clock conversion routines */
  81. /*
  82. * ConvertUTCToLocalDateTime()
  83. *
  84. * Availability:
  85. * Non-Carbon CFM: in UTCUtils 1.0 and later
  86. * CarbonLib: in CarbonLib 1.0.2 and later
  87. * Mac OS X: in version 10.0 and later
  88. */
  89. EXTERN_API_C( OSStatus )
  90. ConvertUTCToLocalDateTime(
  91. const UTCDateTime * utcDateTime,
  92. LocalDateTime * localDateTime);
  93. /*
  94. * ConvertLocalToUTCDateTime()
  95. *
  96. * Availability:
  97. * Non-Carbon CFM: in UTCUtils 1.0 and later
  98. * CarbonLib: in CarbonLib 1.0.2 and later
  99. * Mac OS X: in version 10.0 and later
  100. */
  101. EXTERN_API_C( OSStatus )
  102. ConvertLocalToUTCDateTime(
  103. const LocalDateTime * localDateTime,
  104. UTCDateTime * utcDateTime);
  105. /* Getter and Setter Clock routines using 64 Bit values */
  106. /*
  107. * GetUTCDateTime()
  108. *
  109. * Availability:
  110. * Non-Carbon CFM: in UTCUtils 1.0 and later
  111. * CarbonLib: in CarbonLib 1.0.2 and later
  112. * Mac OS X: in version 10.0 and later
  113. */
  114. EXTERN_API_C( OSStatus )
  115. GetUTCDateTime(
  116. UTCDateTime * utcDateTime,
  117. OptionBits options);
  118. /*
  119. * SetUTCDateTime()
  120. *
  121. * Availability:
  122. * Non-Carbon CFM: in UTCUtils 1.0 and later
  123. * CarbonLib: in CarbonLib 1.0.2 and later
  124. * Mac OS X: in version 10.0 and later
  125. */
  126. EXTERN_API_C( OSStatus )
  127. SetUTCDateTime(
  128. const UTCDateTime * utcDateTime,
  129. OptionBits options);
  130. /*
  131. * GetLocalDateTime()
  132. *
  133. * Availability:
  134. * Non-Carbon CFM: in UTCUtils 1.0 and later
  135. * CarbonLib: in CarbonLib 1.0.2 and later
  136. * Mac OS X: in version 10.0 and later
  137. */
  138. EXTERN_API_C( OSStatus )
  139. GetLocalDateTime(
  140. LocalDateTime * localDateTime,
  141. OptionBits options);
  142. /*
  143. * SetLocalDateTime()
  144. *
  145. * Availability:
  146. * Non-Carbon CFM: in UTCUtils 1.0 and later
  147. * CarbonLib: in CarbonLib 1.0.2 and later
  148. * Mac OS X: in version 10.0 and later
  149. */
  150. EXTERN_API_C( OSStatus )
  151. SetLocalDateTime(
  152. const LocalDateTime * localDateTime,
  153. OptionBits options);
  154. #if PRAGMA_STRUCT_ALIGN
  155. #pragma options align=reset
  156. #elif PRAGMA_STRUCT_PACKPUSH
  157. #pragma pack(pop)
  158. #elif PRAGMA_STRUCT_PACK
  159. #pragma pack()
  160. #endif
  161. #ifdef PRAGMA_IMPORT_OFF
  162. #pragma import off
  163. #elif PRAGMA_IMPORT
  164. #pragma import reset
  165. #endif
  166. #ifdef __cplusplus
  167. }
  168. #endif
  169. #endif /* __UTCUTILS__ */