3 //=============================================================================
7 * @author Prashant Jain
8 * @author Tim H. Harrison
9 * @author Douglas C. Schmidt
11 //=============================================================================
13 #ifndef ACE_SYSTEM_TIME_H
14 #define ACE_SYSTEM_TIME_H
15 #include /**/ "ace/pre.h"
17 #include /**/ "ace/config-all.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #include "ace/Global_Macros.h"
24 #include "ace/os_include/os_time.h" /* For time_t. */
25 #include "ace/os_include/os_limits.h" /* For MAXPATHLEN. */
26 #include "ace/MMAP_Memory_Pool.h"
28 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
30 template<ACE_MEM_POOL_1
, class ACE_LOCK
> class ACE_Malloc
;
31 template<class MALLOC
> class ACE_Allocator_Adapter
;
35 class ACE_MMAP_Memory_Pool
;
38 * @class ACE_System_Time
40 * @brief Defines the timer services of the OS interface to access the
41 * system time either on the local host or on the central time
42 * server in the network.
44 class ACE_Export ACE_System_Time
48 * Enumeration types to specify mode of synchronization with master
49 * clock. Jump will set local system time directly (thus possibly
50 * producing time gaps or ambiguous local system times. Adjust will
51 * smoothly slow down or speed up the local system clock to reach
52 * the system time of the master clock.
54 enum Sync_Mode
{ Jump
, Adjust
};
56 /// Default constructor.
57 ACE_System_Time (const ACE_TCHAR
*poolname
= 0);
59 /// Default destructor.
62 /// Get the local system time, i.e., the value returned by
64 static int get_local_system_time (time_t & time_out
);
66 /// Get the local system time, i.e., the value returned by
68 static int get_local_system_time (ACE_Time_Value
&time_out
);
70 /// Get the system time of the central time server.
71 int get_master_system_time (time_t & time_out
);
73 /// Get the system time of the central time server.
74 int get_master_system_time (ACE_Time_Value
&time_out
);
76 /// Synchronize local system time with the central time server using
78 int sync_local_system_time (ACE_System_Time::Sync_Mode mode
);
81 typedef ACE_Malloc
<ACE_MMAP_MEMORY_POOL
, ACE_Null_Mutex
> MALLOC
;
82 typedef ACE_Allocator_Adapter
<MALLOC
> ALLOCATOR
;
84 /// Our allocator (used for obtaining system time from shared memory).
87 /// The name of the pool used by the allocator.
88 ACE_TCHAR poolname_
[MAXPATHLEN
+ 1];
90 /// Pointer to delta time kept in shared memory.
94 ACE_END_VERSIONED_NAMESPACE_DECL
96 #include /**/ "ace/post.h"
97 #endif /* ACE_SYSTEM_TIME_H */