summaryrefslogtreecommitdiff
path: root/ace/OS.i
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-15 22:46:07 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-15 22:46:07 +0000
commit75f8ea96afb77f1f526c4256554ba54fa57d7d56 (patch)
treea1efbd9a9f0b2a5b1b5afbfd9e4d53aefb5018e8 /ace/OS.i
parente9826ac859768920543197c2c7f6dfa7c1bd1a8d (diff)
downloadATCD-75f8ea96afb77f1f526c4256554ba54fa57d7d56.tar.gz
ChangeLogTag:Thu Jul 15 17:37:07 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'ace/OS.i')
-rw-r--r--ace/OS.i38
1 files changed, 38 insertions, 0 deletions
diff --git a/ace/OS.i b/ace/OS.i
index 37c397fba89..8aa9d358472 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -11934,3 +11934,41 @@ ACE_OS_CString::wchar_rep (void)
{
return this->rep_;
}
+
+ACE_INLINE int
+ACE_Countdown_Time::start (void)
+{
+ if (this->max_wait_time_ != 0)
+ {
+ this->start_time_ = ACE_OS::gettimeofday ();
+ this->stopped_ = 0;
+ }
+ return 0;
+}
+
+ACE_INLINE int
+ACE_Countdown_Time::stop (void)
+{
+ if (this->max_wait_time_ != 0 && this->stopped_ == 0)
+ {
+ ACE_Time_Value elapsed_time =
+ ACE_OS::gettimeofday () - this->start_time_;
+
+ if (*this->max_wait_time_ > elapsed_time)
+ *this->max_wait_time_ -= elapsed_time;
+ else
+ {
+ // Used all of timeout.
+ *this->max_wait_time_ = ACE_Time_Value::zero;
+ // errno = ETIME;
+ }
+ this->stopped_ = 1;
+ }
+ return 0;
+}
+
+ACE_INLINE int
+ACE_Countdown_Time::update (void)
+{
+ return (this->stop () == 0) && this->start ();
+}