Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

System_Time.h

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

Generated on Mon Jun 16 11:21:43 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002