diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-15 22:46:07 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-15 22:46:07 +0000 |
commit | 75f8ea96afb77f1f526c4256554ba54fa57d7d56 (patch) | |
tree | a1efbd9a9f0b2a5b1b5afbfd9e4d53aefb5018e8 /ace/OS.i | |
parent | e9826ac859768920543197c2c7f6dfa7c1bd1a8d (diff) | |
download | ATCD-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.i | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -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 (); +} |