summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2007-02-01 23:49:09 +0000
committerSteve Huston <shuston@riverace.com>2007-02-01 23:49:09 +0000
commit7d36b0d556858656eb013305812e2fbf3ae108c7 (patch)
treec108d3a712a78aab802bdbfd9b79138fae97ace5
parent90e6bf59320e26594892053700cccf80511ed642 (diff)
downloadATCD-7d36b0d556858656eb013305812e2fbf3ae108c7.tar.gz
ChangeLogTag:Thu Feb 1 23:46:27 UTC 2007 Steve Huston <shuston@riverace.com>
-rw-r--r--ACE/ASNMP/tests/test_config.h2
-rw-r--r--ACE/ChangeLog65
-rw-r--r--ACE/NEWS8
-rw-r--r--ACE/ace/Log_Record.cpp14
-rw-r--r--ACE/ace/Log_Record.h10
-rw-r--r--ACE/ace/Log_Record.inl10
-rw-r--r--ACE/ace/Message_Block.cpp2
-rw-r--r--ACE/ace/Message_Block.h2
-rw-r--r--ACE/ace/Time_Value.cpp9
-rw-r--r--ACE/ace/Time_Value.h16
-rw-r--r--ACE/ace/Time_Value.inl54
-rw-r--r--ACE/apps/gperf/src/Gen_Perf.cpp2
-rw-r--r--ACE/examples/APG/Naming/Temperature_Monitor.cpp2
-rw-r--r--ACE/examples/APG/Naming/Temperature_Monitor2.cpp2
-rw-r--r--ACE/examples/ASX/UPIPE_Event_Server/event_server.cpp6
-rw-r--r--ACE/examples/IPC_SAP/SOCK_SAP/CPP-inclient.cpp2
-rw-r--r--ACE/examples/Reactor/Misc/notification.cpp4
-rw-r--r--ACE/examples/Reactor/Multicast/Log_Wrapper.cpp4
-rw-r--r--ACE/examples/Reactor/WFMO_Reactor/Multithreading.cpp2
-rw-r--r--ACE/protocols/ace/RMCast/Link.cpp2
-rw-r--r--ACE/protocols/ace/RMCast/Simulator.cpp2
-rw-r--r--ACE/protocols/examples/TMCast/Member/member.cpp2
-rw-r--r--ACE/tests/Auto_Event_Test.cpp2
-rw-r--r--ACE/tests/Handle_Set_Test.cpp2
-rw-r--r--ACE/tests/High_Res_Timer_Test.cpp19
-rw-r--r--ACE/tests/Recursive_Mutex_Test.cpp2
-rw-r--r--ACE/tests/Semaphore_Test.cpp2
-rw-r--r--ACE/tests/Thread_Mutex_Test.cpp2
-rw-r--r--ACE/tests/Time_Value_Test.cpp2
-rw-r--r--ACE/tests/Timer_Queue_Test.cpp2
30 files changed, 177 insertions, 78 deletions
diff --git a/ACE/ASNMP/tests/test_config.h b/ACE/ASNMP/tests/test_config.h
index a0d2bab7aa8..e1e3912c347 100644
--- a/ACE/ASNMP/tests/test_config.h
+++ b/ACE/ASNMP/tests/test_config.h
@@ -160,7 +160,7 @@ randomize (int array[], size_t size)
for (i = 0; i < size; i++)
array [i] = static_cast<int> (i);
- ACE_OS::srand (ACE_OS::time (0L));
+ ACE_OS::srand ((u_int) ACE_OS::time (0L));
// Generate an array of random numbers from 0 .. size - 1.
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index 6afadc5b8a1..2eb8e6d440f 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,68 @@
+Thu Feb 1 23:46:27 UTC 2007 Steve Huston <shuston@riverace.com>
+
+ * NEWS: Note change to ACE_Log_Record constructor.
+
+ * ace/Log_Record.h (constructor): The "long time_stamp" argument was
+ changed from long to time_t to correspond with what's expected.
+
+ * ace/Log_Record.{h inl cpp}: The secs_ value was changed from
+ ACE_UINT32 to time_t and is handled as a ACE_CDR::LongLong in the
+ CDR insertion and extraction operators. The encode() and decode()
+ methods are deprecated and will be removed in a future version of
+ ACE.
+
+ * ace/Message_Block.cpp (priority_status): Cast sec() value to
+ suseconds_t size to avoid truncation warnings.
+
+ * ace/Time_Value.{h inl cpp}: Use a private struct to manage time
+ internally for Windows since Windows' struct timeval uses long
+ values internally instead of the standard time_t/suseconds_t
+ that the class API uses (and POSIX uses in timeval). When a
+ real OS-defined timeval is needed, build it on the fly for Windows.
+
+ * tests/High_Res_Timer_Test.cpp: When logging ACE_Time_Value-obtained
+ sec/usec values, truncate them down to u_int size. Avoids passing
+ 64-bit values to ACE_Log_Msg when only 32 bits will be taken from
+ the arg vector for a %u format spec. Fixes crashing of this test
+ on Win/VC8.
+
+ * examples/APG/Naming/Temperature_Monitor.cpp:
+ * examples/APG/Naming/Temperature_Monitor2.cpp: Treat time as an int
+ instead of a time_t; makes the logic easier even though it'll break
+ sometime in 2038.
+
+ * examples/ASX/UPIPE_Event_Server/event_server.cpp: Unify use of time_t
+ to hold time values from ACE_OS::time().
+
+ * examples/IPC_SAP/SOCK_SAP/CPP-inclient.cpp: When measuring messages
+ per second, truncate seconds down to a 'long' to avoid truncation
+ warnings at compile time from converting to double.
+
+ * examples/Reactor/Misc/notification.cpp (svc): Initialize an
+ ACE_Time_Value with secs / 2 instead of getting the seconds,
+ multiplying into usecs, then dividing by 2. Avoids data truncation
+ issues.
+
+ * examples/Reactor/Multicast/Log_Wrapper.cpp (log_message): Cast
+ result of time() to long to insert in the multicast buffer. Avoids
+ truncation warning. Will stop recording a legit result sometime in
+ 2038 but the receiver isn't looking at the time field.
+
+ * apps/gperf/src/Gen_Perf.cpp:
+ * ASNMP/tests/test_config.h (randomize):
+ * examples/Reactor/WFMO_Reactor/Multithreading.cpp:
+ * protocols/ace/RMCast/Link.cpp:
+ * protocols/ace/RMCast/Simulator.cpp:
+ * protocols/examples/TMCast/Member/member.cpp:
+ * tests/Auto_Event_Test.cpp:
+ * tests/Handle_Set_Test.cpp:
+ * tests/Recursive_Mutex_Test.cpp:
+ * tests/Semaphore_Test.cpp:
+ * tests/Thread_Mutex_Test.cpp:
+ * tests/Timer_Queue_Test.cpp: Cast time_t to u_int for use as an
+ ACE_OS::srand() seed - we just want some bits, not to fit it back in
+ range with ACE_Utils::Truncate.
+
Thu Feb 1 11:21:32 UTC 2007 Olli Savia <ops@iki.fi>
* ace/POSIX_CB_Proactor.h:
diff --git a/ACE/NEWS b/ACE/NEWS
index b8ab049dcb0..3f366fe34df 100644
--- a/ACE/NEWS
+++ b/ACE/NEWS
@@ -12,6 +12,14 @@ PLANNED CHANGES FOR "ACE-5.5.7"
. (Riverace) Pharlap ETS 13 qualification.
+USER VISIBLE CHANGES BETWEEN ACE-5.5.6 and ACE-5.5.7
+====================================================
+
+. In the ACE_Log_Record (ACE_Log_Priority, long, long) constructor, the
+ second argument, long time_stamp, was changed to be of type time_t. This
+ aligns the type with the expected value, a time stamp such as that returned
+ from ACE_OS::time().
+
USER VISIBLE CHANGES BETWEEN ACE-5.5.5 and ACE-5.5.6
====================================================
diff --git a/ACE/ace/Log_Record.cpp b/ACE/ace/Log_Record.cpp
index a78e258aff8..6d365dd1065 100644
--- a/ACE/ace/Log_Record.cpp
+++ b/ACE/ace/Log_Record.cpp
@@ -110,7 +110,10 @@ ACE_Log_Record::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("length_ = %d\n"), this->length_));
ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ntype_ = %u\n"), this->type_));
- ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ntime_stamp_ = (%d, %d)\n"), this->secs_, this->usecs_));
+ ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ntime_stamp_ = (")
+ ACE_UINT64_FORMAT_SPECIFIER
+ ACE_LIB_TEXT (", %d)\n"),
+ (ACE_UINT64)this->secs_, this->usecs_));
ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\npid_ = %u\n"), this->pid_));
ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nmsg_data_ (0x%@) = %s\n"),
this->msg_data_, this->msg_data_));
@@ -138,7 +141,7 @@ ACE_Log_Record::msg_data (const ACE_TCHAR *data)
}
ACE_Log_Record::ACE_Log_Record (ACE_Log_Priority lp,
- long ts_sec,
+ time_t ts_sec,
long p)
: length_ (0),
type_ (ACE_UINT32 (lp)),
@@ -162,7 +165,7 @@ ACE_Log_Record::ACE_Log_Record (ACE_Log_Priority lp,
long p)
: length_ (0),
type_ (ACE_UINT32 (lp)),
- secs_ ((ACE_UINT32) ts.sec ()),
+ secs_ (ts.sec ()),
usecs_ ((ACE_UINT32) ts.usec ()),
pid_ (ACE_UINT32 (p)),
msg_data_ (0),
@@ -325,7 +328,7 @@ operator<< (ACE_OutputCDR &cdr,
// Insert each field from <log_record> into the output CDR stream.
cdr << ACE_CDR::Long (log_record.type ());
cdr << ACE_CDR::Long (log_record.pid ());
- cdr << ACE_CDR::Long (log_record.time_stamp ().sec ());
+ cdr << ACE_CDR::LongLong (log_record.time_stamp ().sec ());
cdr << ACE_CDR::Long (log_record.time_stamp ().usec ());
cdr << ACE_CDR::ULong (msglen);
#if defined (ACE_USES_WCHAR)
@@ -342,7 +345,8 @@ operator>> (ACE_InputCDR &cdr,
{
ACE_CDR::Long type;
ACE_CDR::Long pid;
- ACE_CDR::Long sec, usec;
+ ACE_CDR::LongLong sec;
+ ACE_CDR::Long usec;
ACE_CDR::ULong buffer_len;
// Extract each field from input CDR stream into <log_record>.
diff --git a/ACE/ace/Log_Record.h b/ACE/ace/Log_Record.h
index 978f2ade5ae..4b8aa552a62 100644
--- a/ACE/ace/Log_Record.h
+++ b/ACE/ace/Log_Record.h
@@ -61,7 +61,7 @@ public:
*/
ACE_Log_Record (void);
ACE_Log_Record (ACE_Log_Priority lp,
- long time_stamp,
+ time_t time_stamp,
long pid);
ACE_Log_Record (ACE_Log_Priority lp,
const ACE_Time_Value &time_stamp,
@@ -106,9 +106,15 @@ public:
// = Marshall/demarshall
/// Encode the <Log_Record> for transmission on the network.
+ /// @deprecated The encode() and decode() metods are deprecated; please use
+ /// the CDR insertion and extraction operators to properly encode and decode
+ /// ACE_Log_Record objects.
void encode (void);
/// Decode the <Log_Record> received from the network.
+ /// @deprecated The encode() and decode() metods are deprecated; please use
+ /// the CDR insertion and extraction operators to properly encode and decode
+ /// ACE_Log_Record objects.
void decode (void);
// = Set/get methods
@@ -184,7 +190,7 @@ private:
ACE_UINT32 type_;
/// Time that the logging record was generated.
- ACE_UINT32 secs_;
+ time_t secs_;
ACE_UINT32 usecs_;
/// Id of process that generated the logging record.
diff --git a/ACE/ace/Log_Record.inl b/ACE/ace/Log_Record.inl
index 5824a038373..268980c6319 100644
--- a/ACE/ace/Log_Record.inl
+++ b/ACE/ace/Log_Record.inl
@@ -25,7 +25,9 @@ ACE_Log_Record::encode (void)
this->type_ = htonl (this->type_);
// Make sure we don't enclose the sec() and usec() fields until
// they've been normalized.
- this->secs_ = htonl (this->secs_);
+ // secs_ is commented out because it can be 64 bits. This method is
+ // deprecated; use the CDR operations instead.
+ // this->secs_ = htonl (this->secs_);
this->usecs_ = htonl (this->usecs_);
this->pid_ = htonl (this->pid_);
#endif /* ACE_LACKS_HTONL */
@@ -36,7 +38,7 @@ ACE_Log_Record::decode (void)
{
ACE_TRACE ("ACE_Log_Record::decode");
#if !defined (ACE_LACKS_NTOHL)
- ACE_Time_Value tv (ntohl (this->secs_),
+ ACE_Time_Value tv (this->secs_,
ntohl (this->usecs_));
this->secs_ = tv.sec ();
@@ -79,14 +81,14 @@ ACE_INLINE ACE_Time_Value
ACE_Log_Record::time_stamp (void) const
{
ACE_TRACE ("ACE_Log_Record::time_stamp");
- return ACE_Time_Value ((long) this->secs_, (long) this->usecs_);
+ return ACE_Time_Value (this->secs_, (long) this->usecs_);
}
ACE_INLINE void
ACE_Log_Record::time_stamp (const ACE_Time_Value &ts)
{
ACE_TRACE ("ACE_Log_Record::time_stamp");
- this->secs_ = (ACE_UINT32) ts.sec ();
+ this->secs_ = ts.sec ();
this->usecs_ = (ACE_UINT32) ts.usec ();
}
diff --git a/ACE/ace/Message_Block.cpp b/ACE/ace/Message_Block.cpp
index d196d6a73dd..feeacac7e7c 100644
--- a/ACE/ace/Message_Block.cpp
+++ b/ACE/ace/Message_Block.cpp
@@ -1290,7 +1290,7 @@ ACE_Dynamic_Message_Strategy::priority_status (ACE_Message_Block & mb,
// the dynamic portion of the message's priority
mb.msg_priority((mb.msg_priority() & static_bit_field_mask_) |
((priority.usec () +
- ACE_ONE_SECOND_IN_USECS * priority.sec ()) <<
+ ACE_ONE_SECOND_IN_USECS * (suseconds_t)(priority.sec())) <<
static_bit_field_shift_));
// returns the priority status of the message
diff --git a/ACE/ace/Message_Block.h b/ACE/ace/Message_Block.h
index 1588e16dd3a..755e2f839cc 100644
--- a/ACE/ace/Message_Block.h
+++ b/ACE/ace/Message_Block.h
@@ -864,7 +864,7 @@ private:
* @brief An abstract base class which provides dynamic priority
* evaluation methods for use by the ACE_Dynamic_Message_Queue
* class or any other class which needs to manage the priorities
- * of a collection of ACE_Message_Block's dynamically.
+ * of a collection of ACE_Message_Blocks dynamically.
*
* Methods for deadline and laxity based priority evaluation are
* provided. These methods assume a specific partitioning of
diff --git a/ACE/ace/Time_Value.cpp b/ACE/ace/Time_Value.cpp
index 25841b6cfa9..61b64c3b5b4 100644
--- a/ACE/ace/Time_Value.cpp
+++ b/ACE/ace/Time_Value.cpp
@@ -23,15 +23,8 @@ const ACE_Time_Value ACE_Time_Value::zero;
// Its primary use is in time computations such as those used by the
// dynamic subpriority strategies in the ACE_Dynamic_Message_Queue class.
// Note: this object requires static construction.
-// Note: On Win64, time_t is 64 bits, yet the timeval members used
-// internally to ACE_Time_Value are still long. This makes time values
-// outside the LONG_MAX, LONG_MIN range very broken.
const ACE_Time_Value ACE_Time_Value::max_time (
-#if !defined (ACE_WIN64)
ACE_Numeric_Limits<time_t>::max (),
-#else
- LONG_MAX,
-#endif
ACE_ONE_SECOND_IN_USECS - 1);
ACE_ALLOC_HOOK_DEFINE (ACE_Time_Value)
@@ -226,7 +219,7 @@ ACE_Time_Value::operator *= (double d)
+ static_cast<double> (this->usec ()) / ACE_ONE_SECOND_IN_USECS) * d;
// shall we saturate the result?
-#if !defined(ACE_LACKS_NUMERIC_LIMITS) && !defined (ACE_WIN64)
+#if !defined(ACE_LACKS_NUMERIC_LIMITS)
static const double max_int = std::numeric_limits<time_t>::max () + 0.999999;
static const double min_int = std::numeric_limits<time_t>::min () - 0.999999;
#else
diff --git a/ACE/ace/Time_Value.h b/ACE/ace/Time_Value.h
index 51746d067eb..9adfe5c3ffd 100644
--- a/ACE/ace/Time_Value.h
+++ b/ACE/ace/Time_Value.h
@@ -322,7 +322,23 @@ private:
void normalize (void);
/// Store the values as a timeval.
+#if defined (ACE_WIN32)
+ // Windows' timeval is non-conformant, so swap in a struct that conforms
+ // to the proper data types to represent the entire time range that this
+ // class's API can accept.
+ // Also, since this class can supply a pointer to a timeval that things
+ // like select() expect, we need the OS-defined one as well. To make this
+ // available, use a real timeval called ext_tv_ and set it up when needed.
+ // Since this is most often for relative times that don't approach 32 bits
+ // in size, reducing a time_t to fit should be no problem.
+ struct {
+ time_t tv_sec;
+ suseconds_t tv_usec;
+ } tv_;
+ timeval ext_tv_;
+#else
timeval tv_;
+#endif /* ACE_WIN32 */
};
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ACE/ace/Time_Value.inl b/ACE/ace/Time_Value.inl
index 75c34a2e2cc..a9da32db220 100644
--- a/ACE/ace/Time_Value.inl
+++ b/ACE/ace/Time_Value.inl
@@ -4,6 +4,8 @@
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+#include "ace/Truncate.h"
+
#if defined (ACE_WIN32) && defined (_WIN32_WCE)
// Something is a bit brain-damaged here and I'm not sure what... this code
// compiled before the OS reorg for ACE 5.4. Since then it hasn't - eVC
@@ -20,7 +22,15 @@ ACE_INLINE
ACE_Time_Value::operator timeval () const
{
// ACE_OS_TRACE ("ACE_Time_Value::operator timeval");
+#if defined (ACE_WIN32)
+ // Recall that on Windows we substitute another type for timeval in tv_
+ ACE_Time_Value *me = const_cast<ACE_Time_Value*> (this);
+ me->ext_tv_.tv_sec = ACE_Utils::Truncate<long> (this->tv_.tv_sec);
+ me->ext_tv_.tv_usec = ACE_Utils::Truncate<long> (this->tv_.tv_usec);
+ return this->ext_tv_;
+#else
return this->tv_;
+#endif /* ACE_WIN32 */
}
ACE_INLINE void
@@ -45,26 +55,22 @@ ACE_INLINE
ACE_Time_Value::operator const timeval * () const
{
// ACE_OS_TRACE ("ACE_Time_Value::operator const timeval *");
+#if defined (ACE_WIN32)
+ // Recall that on Windows we substitute another type for timeval in tv_
+ ACE_Time_Value *me = const_cast<ACE_Time_Value*> (this);
+ me->ext_tv_.tv_sec = ACE_Utils::Truncate<long> (this->tv_.tv_sec);
+ me->ext_tv_.tv_usec = ACE_Utils::Truncate<long> (this->tv_.tv_usec);
+ return (const timeval *) &this->ext_tv_;
+#else
return (const timeval *) &this->tv_;
+#endif /* ACE_WIN32 */
}
ACE_INLINE void
ACE_Time_Value::set (time_t sec, suseconds_t usec)
{
// ACE_OS_TRACE ("ACE_Time_Value::set");
-#if defined (ACE_WIN64) \
- || (defined (ACE_WIN32) && !defined (_USE_32BIT_TIME_T))
- // Win64 uses 'long' (32 bit) timeval and 64-bit time_t, so we have
- // to get these back in range.
- if (sec > LONG_MAX)
- this->tv_.tv_sec = LONG_MAX;
- else if (sec < LONG_MIN)
- this->tv_.tv_sec = LONG_MIN;
- else
- this->tv_.tv_sec = static_cast<long> (sec);
-#else
this->tv_.tv_sec = sec;
-#endif
this->tv_.tv_usec = usec;
#if __GNUC__
if (__builtin_constant_p(sec) &&
@@ -128,19 +134,7 @@ ACE_INLINE void
ACE_Time_Value::sec (time_t sec)
{
// ACE_OS_TRACE ("ACE_Time_Value::sec");
-#if defined (ACE_WIN64) \
- || (defined (ACE_WIN32) && !defined (_USE_32BIT_TIME_T))
- // Win64 uses 'long' (32 bit) timeval and 64-bit time_t, so we have
- // to get these back in range.
- if (sec > LONG_MAX)
- this->tv_.tv_sec = LONG_MAX;
- else if (sec < LONG_MIN)
- this->tv_.tv_sec = LONG_MIN;
- else
- this->tv_.tv_sec = static_cast<long> (sec);
-#else
this->tv_.tv_sec = sec;
-#endif
}
// Converts from Time_Value format into milli-seconds format.
@@ -149,7 +143,12 @@ ACE_INLINE unsigned long
ACE_Time_Value::msec (void) const
{
// ACE_OS_TRACE ("ACE_Time_Value::msec");
- return this->tv_.tv_sec * 1000 + this->tv_.tv_usec / 1000;
+
+ // Note - we're truncating a value here, which can lose data. This is
+ // called out in the user documentation for this with a recommendation to
+ // use msec(ACE_UINT64&) instead, so just go ahead and truncate.
+ time_t secs = this->tv_.tv_sec * 1000 + this->tv_.tv_usec / 1000;
+ return ACE_Utils::Truncate<unsigned long> (secs);
}
#if !defined (ACE_LACKS_LONGLONG_T)
@@ -170,9 +169,10 @@ ACE_Time_Value::msec (long milliseconds)
{
// ACE_OS_TRACE ("ACE_Time_Value::msec");
// Convert millisecond units to seconds;
- this->tv_.tv_sec = milliseconds / 1000;
+ long secs = milliseconds / 1000;
+ this->tv_.tv_sec = secs;
// Convert remainder to microseconds;
- this->tv_.tv_usec = (milliseconds - (this->tv_.tv_sec * 1000)) * 1000;
+ this->tv_.tv_usec = (milliseconds - (secs * 1000)) * 1000;
}
// Returns number of micro-seconds.
diff --git a/ACE/apps/gperf/src/Gen_Perf.cpp b/ACE/apps/gperf/src/Gen_Perf.cpp
index 88c362e0218..1714ee33acf 100644
--- a/ACE/apps/gperf/src/Gen_Perf.cpp
+++ b/ACE/apps/gperf/src/Gen_Perf.cpp
@@ -251,7 +251,7 @@ Gen_Perf::open (void)
if (option[RANDOM])
{
- ACE_OS::srand (ACE_OS::time (0));
+ ACE_OS::srand ((u_int) ACE_OS::time (0));
for (int i = 0; i < ACE_STANDARD_CHARACTER_SET_SIZE; i++)
Vectors::asso_values[i] = (ACE_OS::rand () & asso_value_max - 1);
diff --git a/ACE/examples/APG/Naming/Temperature_Monitor.cpp b/ACE/examples/APG/Naming/Temperature_Monitor.cpp
index 8ac841b4108..2068470c706 100644
--- a/ACE/examples/APG/Naming/Temperature_Monitor.cpp
+++ b/ACE/examples/APG/Naming/Temperature_Monitor.cpp
@@ -48,7 +48,7 @@ void Temperature_Monitor::record_failure (void)
// Listing 41
// Listing 42 code/ch21
- int now = ACE_OS::time ();
+ int now = (int) ACE_OS::time ();
int lastResetTime;
if (lastReset.get ())
{
diff --git a/ACE/examples/APG/Naming/Temperature_Monitor2.cpp b/ACE/examples/APG/Naming/Temperature_Monitor2.cpp
index b24f1c1f329..605e0601d53 100644
--- a/ACE/examples/APG/Naming/Temperature_Monitor2.cpp
+++ b/ACE/examples/APG/Naming/Temperature_Monitor2.cpp
@@ -89,7 +89,7 @@ void Temperature_Monitor2::record_failure (void)
Name_Binding_Ptr lastReset (this->naming_context_.fetch ("lastReset"));
Name_Binding_Ptr resetCount (this->naming_context_.fetch ("resetCount"));
- int now = ACE_OS::time ();
+ int now = (int) ACE_OS::time ();
int lastFailureTime;
int lastResetTime = 0;
diff --git a/ACE/examples/ASX/UPIPE_Event_Server/event_server.cpp b/ACE/examples/ASX/UPIPE_Event_Server/event_server.cpp
index e1d5b8c440d..a31dbafe0d7 100644
--- a/ACE/examples/ASX/UPIPE_Event_Server/event_server.cpp
+++ b/ACE/examples/ASX/UPIPE_Event_Server/event_server.cpp
@@ -69,7 +69,7 @@ consumer (void *)
int verb = options.verbose ();
int msiz = options.message_size ();
- int secs, par1, par2;
+ time_t secs, par1, par2;
time_t currsec;
if (verb)
@@ -88,7 +88,7 @@ consumer (void *)
int cnt = 0;
ACE_OS::time (&currsec);
- par1= (time_t) currsec;
+ par1 = currsec;
while (done == 0
&& (c_stream.recv (mb_p) != -1))
@@ -109,7 +109,7 @@ consumer (void *)
}
ACE_OS::time (&currsec);
- par2 = (time_t) currsec;
+ par2 = currsec;
secs = par2 - par1;
diff --git a/ACE/examples/IPC_SAP/SOCK_SAP/CPP-inclient.cpp b/ACE/examples/IPC_SAP/SOCK_SAP/CPP-inclient.cpp
index a9301b44b5e..95583fe5c16 100644
--- a/ACE/examples/IPC_SAP/SOCK_SAP/CPP-inclient.cpp
+++ b/ACE/examples/IPC_SAP/SOCK_SAP/CPP-inclient.cpp
@@ -354,7 +354,7 @@ Options::twoway_client_test (void *)
ACE_Time_Value tv;
timer.elapsed_time_incr (tv);
- double real_time = tv.sec () * ACE_ONE_SECOND_IN_USECS + tv.usec ();
+ double real_time = (long) tv.sec () * ACE_ONE_SECOND_IN_USECS + tv.usec ();
double messages_per_sec = iteration * double (ACE_ONE_SECOND_IN_USECS) / real_time;
ACE_DEBUG ((LM_DEBUG,
diff --git a/ACE/examples/Reactor/Misc/notification.cpp b/ACE/examples/Reactor/Misc/notification.cpp
index a04663b28ad..a49aed52f9c 100644
--- a/ACE/examples/Reactor/Misc/notification.cpp
+++ b/ACE/examples/Reactor/Misc/notification.cpp
@@ -236,9 +236,7 @@ Thread_Handler::handle_input (ACE_HANDLE handle)
int
Thread_Handler::svc (void)
{
- ACE_Time_Value sleep_timeout (0,
- // Transform this into microseconds and divide by 2.
- (Thread_Handler::interval_.sec () * ACE_ONE_SECOND_IN_USECS) / 2);
+ ACE_Time_Value sleep_timeout (Thread_Handler::interval_.sec () / 2);
for (int i = this->iterations_;
i > 0;
diff --git a/ACE/examples/Reactor/Multicast/Log_Wrapper.cpp b/ACE/examples/Reactor/Multicast/Log_Wrapper.cpp
index b35568b4a88..547430e08e9 100644
--- a/ACE/examples/Reactor/Multicast/Log_Wrapper.cpp
+++ b/ACE/examples/Reactor/Multicast/Log_Wrapper.cpp
@@ -63,7 +63,9 @@ Log_Wrapper::log_message (Log_Priority type, char *message)
sequence_number_++;
this->log_msg_.type = type;
- this->log_msg_.time = time (0);
+ // Casting time() to long will start causing bad results sometime in 2038
+ // but the receiver isn't looking at the time, so who cares?
+ this->log_msg_.time = (long) time (0);
this->log_msg_.msg_length = ACE_OS::strlen(message)+1;
this->log_msg_.sequence_number = ACE_HTONL(sequence_number_);
diff --git a/ACE/examples/Reactor/WFMO_Reactor/Multithreading.cpp b/ACE/examples/Reactor/WFMO_Reactor/Multithreading.cpp
index 0778f375251..ba4565cfd95 100644
--- a/ACE/examples/Reactor/WFMO_Reactor/Multithreading.cpp
+++ b/ACE/examples/Reactor/WFMO_Reactor/Multithreading.cpp
@@ -212,7 +212,7 @@ ACE_TMAIN (int argc, ACE_TCHAR **argv)
Task_Handler task (number_of_handles,
concurrent_threads);
- ACE_OS::srand (ACE_OS::time (0L));
+ ACE_OS::srand ((u_int) ACE_OS::time (0L));
for (int i = 1; i <= iterations; i++)
{
diff --git a/ACE/protocols/ace/RMCast/Link.cpp b/ACE/protocols/ace/RMCast/Link.cpp
index bf670c04de0..979041dbe00 100644
--- a/ACE/protocols/ace/RMCast/Link.cpp
+++ b/ACE/protocols/ace/RMCast/Link.cpp
@@ -30,7 +30,7 @@ namespace ACE_RMCast
stop_ (false)
{
- srand (time (0));
+ srand ((unsigned int) time (0));
rsock_.set_option (IP_MULTICAST_LOOP, 0);
diff --git a/ACE/protocols/ace/RMCast/Simulator.cpp b/ACE/protocols/ace/RMCast/Simulator.cpp
index ca6d81d47e4..ed0d786e535 100644
--- a/ACE/protocols/ace/RMCast/Simulator.cpp
+++ b/ACE/protocols/ace/RMCast/Simulator.cpp
@@ -9,7 +9,7 @@ namespace ACE_RMCast
Simulator::
Simulator ()
{
- srand (time (0));
+ srand ((unsigned int)time (0));
}
void Simulator::
diff --git a/ACE/protocols/examples/TMCast/Member/member.cpp b/ACE/protocols/examples/TMCast/Member/member.cpp
index f89c68564ea..7aad7736ccf 100644
--- a/ACE/protocols/examples/TMCast/Member/member.cpp
+++ b/ACE/protocols/examples/TMCast/Member/member.cpp
@@ -28,7 +28,7 @@ ACE_TMAIN (int argc, ACE_TCHAR* argv[])
else if (argv[1][0] == 's') receiver = false;
else throw Args ();
- if (!receiver) ACE_OS::srand (ACE_OS::time ());
+ if (!receiver) ACE_OS::srand ((u_int) ACE_OS::time ());
ACE_INET_Addr address (argv[3]);
diff --git a/ACE/tests/Auto_Event_Test.cpp b/ACE/tests/Auto_Event_Test.cpp
index a31b8a9f6a1..b7fd8c59049 100644
--- a/ACE/tests/Auto_Event_Test.cpp
+++ b/ACE/tests/Auto_Event_Test.cpp
@@ -186,7 +186,7 @@ int run_main (int argc, ACE_TCHAR *argv[])
#if defined (ACE_HAS_THREADS)
parse_args (argc, argv);
- ACE_OS::srand (ACE_OS::time (0L));
+ ACE_OS::srand ((u_int) ACE_OS::time (0L));
//Test timed waits.
for (size_t i = 0; i < test_timeout_count; i++)
diff --git a/ACE/tests/Handle_Set_Test.cpp b/ACE/tests/Handle_Set_Test.cpp
index 61e48e0a2c4..17f83625f4b 100644
--- a/ACE/tests/Handle_Set_Test.cpp
+++ b/ACE/tests/Handle_Set_Test.cpp
@@ -35,7 +35,7 @@ test_duplicates (size_t count)
ACE_Handle_Set handle_set;
- ACE_OS::srand (ACE_OS::time (0L));
+ ACE_OS::srand ((u_int) ACE_OS::time (0L));
for (size_t i = 0; i < count; i++)
{
diff --git a/ACE/tests/High_Res_Timer_Test.cpp b/ACE/tests/High_Res_Timer_Test.cpp
index 5398157d8d3..87c02b88d18 100644
--- a/ACE/tests/High_Res_Timer_Test.cpp
+++ b/ACE/tests/High_Res_Timer_Test.cpp
@@ -21,19 +21,20 @@
#include "ace/Sched_Params.h"
#include "ace/Get_Opt.h"
#include "ace/OS_NS_unistd.h"
+#include "ace/Truncate.h"
ACE_RCSID(tests, High_Res_Timer_Test, "High_Res_Timer_Test.cpp,v 4.6 2000/04/23 04:43:58 brunsch Exp")
static
u_int
-check (const u_int interval, const u_int measured)
+check (const time_t interval, const time_t measured)
{
const u_int threshold = 25 /* percent */;
- const u_int difference =
+ const time_t difference =
interval > measured ? interval - measured : measured - interval;
- const u_int percentage_difference = difference * 100 / interval;
+ const u_int percentage_difference = (u_int) (difference * 100 / interval);
if (percentage_difference < threshold)
return 0;
@@ -41,8 +42,8 @@ check (const u_int interval, const u_int measured)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("The measured time of %u differs from ")
ACE_TEXT ("the interval of %u by %u percent.\n"),
- measured,
- interval,
+ (unsigned int) measured,
+ (unsigned int) interval,
percentage_difference),
1);
}
@@ -137,10 +138,14 @@ run_main (int argc, ACE_TCHAR *argv[])
const ACE_Time_Value measured = time_interval (interval,
nanoseconds,
microseconds);
+ u_int interval_usec =
+ ACE_Utils::Truncate<u_int> (interval.sec () * 1000000 + interval.usec ());
+ u_int measured_usec =
+ ACE_Utils::Truncate<u_int> (measured.sec () * 1000000 + measured.usec ());
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("interval: %u usec, measured: %u usec%s\n"),
- interval.sec () * 1000000 + interval.usec (),
- measured.sec () * 1000000 + measured.usec (),
+ interval_usec,
+ measured_usec,
intervals[i] <= TIMER_RESOLUTION ?
ACE_TEXT (" (interval and measured may differ)") :
ACE_TEXT ("")));
diff --git a/ACE/tests/Recursive_Mutex_Test.cpp b/ACE/tests/Recursive_Mutex_Test.cpp
index f99dba58ff0..787e76f6ff3 100644
--- a/ACE/tests/Recursive_Mutex_Test.cpp
+++ b/ACE/tests/Recursive_Mutex_Test.cpp
@@ -91,7 +91,7 @@ test_timed_wait (int nesting_level,
rm);
else
{
- ACE_OS::srand (ACE_OS::time (0));
+ ACE_OS::srand ((u_int) ACE_OS::time (0));
for (size_t i = 0; i < ACE_MAX_ITERATIONS / 2; i++)
{
diff --git a/ACE/tests/Semaphore_Test.cpp b/ACE/tests/Semaphore_Test.cpp
index e2b82042559..fb5ccc36dce 100644
--- a/ACE/tests/Semaphore_Test.cpp
+++ b/ACE/tests/Semaphore_Test.cpp
@@ -201,7 +201,7 @@ int run_main (int argc, ACE_TCHAR *argv[])
#if defined (ACE_HAS_THREADS)
parse_args (argc, argv);
- ACE_OS::srand (ACE_OS::time (0L));
+ ACE_OS::srand ((u_int) ACE_OS::time (0L));
# if !defined (ACE_HAS_STHREADS) && (!defined (ACE_HAS_POSIX_SEM) || defined (ACE_HAS_POSIX_SEM_TIMEOUT))
//Test timed waits.
diff --git a/ACE/tests/Thread_Mutex_Test.cpp b/ACE/tests/Thread_Mutex_Test.cpp
index a463e72b523..048aa855a6a 100644
--- a/ACE/tests/Thread_Mutex_Test.cpp
+++ b/ACE/tests/Thread_Mutex_Test.cpp
@@ -50,7 +50,7 @@ test (void *args)
{
ACE_TEST_MUTEX *mutex = (ACE_TEST_MUTEX *) args;
ACE_UNUSED_ARG (mutex); // Suppress ghs warning about unused local "mutex".
- ACE_OS::srand (ACE_OS::time (0));
+ ACE_OS::srand ((u_int) ACE_OS::time (0));
for (size_t i = 0; i < ACE_MAX_ITERATIONS / 2; i++)
{
diff --git a/ACE/tests/Time_Value_Test.cpp b/ACE/tests/Time_Value_Test.cpp
index 764b23f406d..865bbb7d265 100644
--- a/ACE/tests/Time_Value_Test.cpp
+++ b/ACE/tests/Time_Value_Test.cpp
@@ -252,7 +252,7 @@ run_main (int, ACE_TCHAR *[])
tv1 *= -10.0;
ACE_ASSERT (tv1.sec () == tv2.sec () && tv1.usec () == tv2.usec ());
-#if !defined(ACE_LACKS_NUMERIC_LIMITS) && !defined (ACE_WIN64)
+#if !defined(ACE_LACKS_NUMERIC_LIMITS)
const time_t max_time_t = std::numeric_limits<time_t>::max ();
const time_t min_time_t = std::numeric_limits<time_t>::min ();
#else
diff --git a/ACE/tests/Timer_Queue_Test.cpp b/ACE/tests/Timer_Queue_Test.cpp
index 5f364c2f21b..1a788f1fc26 100644
--- a/ACE/tests/Timer_Queue_Test.cpp
+++ b/ACE/tests/Timer_Queue_Test.cpp
@@ -568,7 +568,7 @@ run_main (int argc, ACE_TCHAR *argv[])
{
ACE_START_TEST (ACE_TEXT ("Timer_Queue_Test"));
- ACE_OS::srand (ACE_OS::time (0L));
+ ACE_OS::srand ((u_int) ACE_OS::time (0L));
if (argc > 1)
max_iterations = ACE_OS::atoi (argv[1]);