*Backed out changeset 3be01fb200a5
--HG-- branch : trunk
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// $Id: System_Time.cpp 80826 2008-03-04 14:51:23Z wotte $
|
||||
|
||||
#include "ace/System_Time.h"
|
||||
#include "ace/MMAP_Memory_Pool.h"
|
||||
#include "ace/Malloc_T.h"
|
||||
@@ -6,13 +7,17 @@
|
||||
#include "ace/Time_Value.h"
|
||||
#include "ace/OS_NS_string.h"
|
||||
#include "ace/OS_NS_time.h"
|
||||
|
||||
ACE_RCSID(ace, System_Time, "$Id: System_Time.cpp 80826 2008-03-04 14:51:23Z wotte $")
|
||||
|
||||
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
|
||||
|
||||
ACE_System_Time::ACE_System_Time (const ACE_TCHAR *poolname)
|
||||
: shmem_ (0)
|
||||
, delta_time_ (0)
|
||||
{
|
||||
ACE_TRACE ("ACE_System_Time::ACE_System_Time");
|
||||
|
||||
// Only create a new unique filename for the memory pool file
|
||||
// if the user didn't supply one...
|
||||
if (poolname == 0)
|
||||
@@ -31,23 +36,29 @@ ACE_System_Time::ACE_System_Time (const ACE_TCHAR *poolname)
|
||||
ACE_TEXT ("defaulting to current directory\n")));
|
||||
this->poolname_[0] = 0;
|
||||
}
|
||||
|
||||
// Add the filename to the end
|
||||
ACE_OS::strcat (this->poolname_, ACE_TEXT ("ace-malloc-XXXXXX"));
|
||||
|
||||
#endif /* ACE_DEFAULT_BACKING_STORE */
|
||||
}
|
||||
else
|
||||
ACE_OS::strsncpy (this->poolname_,
|
||||
poolname,
|
||||
(sizeof this->poolname_ / sizeof (ACE_TCHAR)));
|
||||
|
||||
ACE_NEW (this->shmem_,
|
||||
ALLOCATOR (this->poolname_));
|
||||
}
|
||||
|
||||
ACE_System_Time::~ACE_System_Time (void)
|
||||
{
|
||||
ACE_TRACE ("ACE_System_Time::~ACE_System_Time");
|
||||
delete this->shmem_;
|
||||
}
|
||||
|
||||
// Get the local system time.
|
||||
|
||||
int
|
||||
ACE_System_Time::get_local_system_time (time_t & time_out)
|
||||
{
|
||||
@@ -55,6 +66,7 @@ ACE_System_Time::get_local_system_time (time_t & time_out)
|
||||
time_out = ACE_OS::time (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ACE_System_Time::get_local_system_time (ACE_Time_Value &time_out)
|
||||
{
|
||||
@@ -62,11 +74,14 @@ ACE_System_Time::get_local_system_time (ACE_Time_Value &time_out)
|
||||
time_out.set (ACE_OS::time (0), 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get the system time of the central time server.
|
||||
|
||||
int
|
||||
ACE_System_Time::get_master_system_time (time_t &time_out)
|
||||
{
|
||||
ACE_TRACE ("ACE_System_Time::get_master_system_time");
|
||||
|
||||
if (this->delta_time_ == 0)
|
||||
{
|
||||
// Try to find it
|
||||
@@ -81,7 +96,9 @@ ACE_System_Time::get_master_system_time (time_t &time_out)
|
||||
// Extract the delta time.
|
||||
this->delta_time_ = static_cast<long *> (temp);
|
||||
}
|
||||
|
||||
time_t local_time;
|
||||
|
||||
// If delta_time is positive, it means that the system clock is
|
||||
// ahead of our local clock so add delta to the local time to get an
|
||||
// approximation of the system time. Else if delta time is negative,
|
||||
@@ -98,6 +115,7 @@ ACE_System_Time::get_master_system_time (time_t &time_out)
|
||||
time_out = *(this->delta_time_ + 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ACE_System_Time::get_master_system_time (ACE_Time_Value &time_out)
|
||||
{
|
||||
@@ -108,13 +126,16 @@ ACE_System_Time::get_master_system_time (ACE_Time_Value &time_out)
|
||||
time_out.sec (to);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Synchronize local system time with the central time server using
|
||||
// specified mode (currently unimplemented).
|
||||
|
||||
int
|
||||
ACE_System_Time::sync_local_system_time (ACE_System_Time::Sync_Mode)
|
||||
{
|
||||
ACE_TRACE ("ACE_System_Time::sync_local_system_time");
|
||||
ACE_NOTSUP_RETURN (-1);
|
||||
}
|
||||
|
||||
ACE_END_VERSIONED_NAMESPACE_DECL
|
||||
|
||||
|
||||
Reference in New Issue
Block a user