UTCUtils.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:4k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       UTCUtils.h
  3.  
  4.      Contains:   Interface for UTC to Local Time conversion and 64 Bit Clock routines
  5.  
  6.      Version:    Technology: Mac OS 9
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1999-2001 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __UTCUTILS__
  18. #define __UTCUTILS__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __MACERRORS__
  23. #include "MacErrors.h"
  24. #endif
  25. #if PRAGMA_ONCE
  26. #pragma once
  27. #endif
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. #if PRAGMA_IMPORT
  32. #pragma import on
  33. #endif
  34. #if PRAGMA_STRUCT_ALIGN
  35.     #pragma options align=mac68k
  36. #elif PRAGMA_STRUCT_PACKPUSH
  37.     #pragma pack(push, 2)
  38. #elif PRAGMA_STRUCT_PACK
  39.     #pragma pack(2)
  40. #endif
  41. /* Options for Set & Get DateTime Routines */
  42. enum {
  43.     kUTCDefaultOptions          = 0
  44. };
  45. /* 64 Bit Clock Typedefs */
  46. struct UTCDateTime {
  47.     UInt16                          highSeconds;
  48.     UInt32                          lowSeconds;
  49.     UInt16                          fraction;
  50. };
  51. typedef struct UTCDateTime              UTCDateTime;
  52. typedef UTCDateTime *                   UTCDateTimePtr;
  53. typedef UTCDateTimePtr *                UTCDateTimeHandle;
  54. struct LocalDateTime {
  55.     UInt16                          highSeconds;
  56.     UInt32                          lowSeconds;
  57.     UInt16                          fraction;
  58. };
  59. typedef struct LocalDateTime            LocalDateTime;
  60. typedef LocalDateTime *                 LocalDateTimePtr;
  61. typedef LocalDateTimePtr *              LocalDateTimeHandle;
  62. /* Classic 32 bit clock conversion routines */
  63. #if CALL_NOT_IN_CARBON
  64. EXTERN_API_C( OSStatus )
  65. ConvertLocalTimeToUTC           (UInt32                 localSeconds,
  66.                                  UInt32 *               utcSeconds);
  67. EXTERN_API_C( OSStatus )
  68. ConvertUTCToLocalTime           (UInt32                 utcSeconds,
  69.                                  UInt32 *               localSeconds);
  70. /* 64 bit clock conversion routines */
  71. EXTERN_API_C( OSStatus )
  72. ConvertUTCToLocalDateTime       (const UTCDateTime *    utcDateTime,
  73.                                  LocalDateTime *        localDateTime);
  74. EXTERN_API_C( OSStatus )
  75. ConvertLocalToUTCDateTime       (const LocalDateTime *  localDateTime,
  76.                                  UTCDateTime *          utcDateTime);
  77. /* Getter and Setter Clock routines using 64 Bit values */
  78. EXTERN_API_C( OSStatus )
  79. GetUTCDateTime                  (UTCDateTime *          utcDateTime,
  80.                                  OptionBits             options);
  81. EXTERN_API_C( OSStatus )
  82. SetUTCDateTime                  (const UTCDateTime *    utcDateTime,
  83.                                  OptionBits             options);
  84. EXTERN_API_C( OSStatus )
  85. GetLocalDateTime                (LocalDateTime *        localDateTime,
  86.                                  OptionBits             options);
  87. EXTERN_API_C( OSStatus )
  88. SetLocalDateTime                (const LocalDateTime *  localDateTime,
  89.                                  OptionBits             options);
  90. #endif  /* CALL_NOT_IN_CARBON */
  91. #if PRAGMA_STRUCT_ALIGN
  92.     #pragma options align=reset
  93. #elif PRAGMA_STRUCT_PACKPUSH
  94.     #pragma pack(pop)
  95. #elif PRAGMA_STRUCT_PACK
  96.     #pragma pack()
  97. #endif
  98. #ifdef PRAGMA_IMPORT_OFF
  99. #pragma import off
  100. #elif PRAGMA_IMPORT
  101. #pragma import reset
  102. #endif
  103. #ifdef __cplusplus
  104. }
  105. #endif
  106. #endif /* __UTCUTILS__ */