System_Time.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    System_Time.h
00006  *
00007  *  System_Time.h,v 4.23 2006/05/30 10:17:48 jwillemsen Exp
00008  *
00009  *  @author Prashant Jain
00010  *  @author Tim H. Harrison and Douglas C. Schmidt
00011  */
00012 //=============================================================================
00013 
00014 #ifndef ACE_SYSTEM_TIME_H
00015 #define ACE_SYSTEM_TIME_H
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "ace/config-all.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "ace/MMAP_Memory_Pool.h"
00025 #include "ace/Malloc_T.h"
00026 #include "ace/Null_Mutex.h"
00027 
00028 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00029 
00030 /**
00031  * @class ACE_System_Time
00032  *
00033  * @brief Defines the timer services of the OS interface to access the
00034  * system time either on the local host or on the central time
00035  * server in the network.
00036  */
00037 class ACE_Export ACE_System_Time
00038 {
00039 public:
00040   /**
00041    * Enumeration types to specify mode of synchronization with master
00042    * clock.  Jump will set local system time directly (thus possibly
00043    * producing time gaps or ambiguous local system times.  Adjust will
00044    * smoothly slow down or speed up the local system clock to reach
00045    * the system time of the master clock.
00046    */
00047   enum Sync_Mode { Jump, Adjust };
00048 
00049   /// Default constructor.
00050   ACE_System_Time (const ACE_TCHAR *poolname = 0);
00051 
00052   /// Default destructor.
00053   ~ACE_System_Time (void);
00054 
00055   /// Get the local system time, i.e., the value returned by
00056   /// ACE_OS::time().
00057   static int get_local_system_time (ACE_UINT32 &time_out);
00058 
00059   /// Get the local system time, i.e., the value returned by
00060   /// ACE_OS::time().
00061   static int get_local_system_time (ACE_Time_Value &time_out);
00062 
00063   /// Get the system time of the central time server.
00064   int get_master_system_time (ACE_UINT32 &time_out);
00065 
00066   /// Get the system time of the central time server.
00067   int get_master_system_time (ACE_Time_Value &time_out);
00068 
00069   /// Synchronize local system time with the central time server using
00070   /// specified mode.
00071   int sync_local_system_time (ACE_System_Time::Sync_Mode mode);
00072 
00073 private:
00074   typedef ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> MALLOC;
00075   typedef ACE_Allocator_Adapter<MALLOC> ALLOCATOR;
00076 
00077   /// Our allocator (used for obtaining system time from shared memory).
00078   ALLOCATOR *shmem_;
00079 
00080   /// The name of the pool used by the allocator.
00081   ACE_TCHAR poolname_[MAXPATHLEN + 1];
00082 
00083   /// Pointer to delta time kept in shared memory.
00084   long *delta_time_;
00085 };
00086 
00087 ACE_END_VERSIONED_NAMESPACE_DECL
00088 
00089 #include /**/ "ace/post.h"
00090 #endif /* ACE_SYSTEM_TIME_H */

Generated on Thu Nov 9 09:42:06 2006 for ACE by doxygen 1.3.6