BasicUsageEnvironment/DelayQueue.cpp File Reference

#include "DelayQueue.hh"
#include "GroupsockHelper.hh"

Include dependency graph for DelayQueue.cpp:

Go to the source code of this file.

Defines

#define INT_MAX   0x7FFFFFFF

Functions

DelayInterval operator- (const Timeval &arg1, const Timeval &arg2)
DelayInterval operator * (short arg1, const DelayInterval &arg2)
EventTime TimeNow ()

Variables

static const int MILLION = 1000000
const DelayInterval DELAY_ZERO (0, 0)
const DelayInterval DELAY_SECOND (1, 0)
const DelayInterval ETERNITY (INT_MAX, MILLION-1)
const EventTime THE_END_OF_TIME (INT_MAX)


Define Documentation

#define INT_MAX   0x7FFFFFFF

Definition at line 82 of file DelayQueue.cpp.


Function Documentation

DelayInterval operator * ( short  arg1,
const DelayInterval arg2 
)

Definition at line 70 of file DelayQueue.cpp.

References MILLION, Timeval::seconds(), and Timeval::useconds().

00070                                                                {
00071   time_base_seconds result_seconds = arg1*arg2.seconds();
00072   time_base_seconds result_useconds = arg1*arg2.useconds();
00073 
00074   time_base_seconds carry = result_useconds/MILLION;
00075   result_useconds -= carry*MILLION;
00076   result_seconds += carry;
00077 
00078   return DelayInterval(result_seconds, result_useconds);
00079 }

DelayInterval operator- ( const Timeval arg1,
const Timeval arg2 
)

Definition at line 53 of file DelayQueue.cpp.

References DELAY_ZERO, MILLION, Timeval::seconds(), Timeval::secs(), Timeval::useconds(), and Timeval::usecs().

00053                                                                   {
00054   time_base_seconds secs = arg1.seconds() - arg2.seconds();
00055   time_base_seconds usecs = arg1.useconds() - arg2.useconds();
00056 
00057   if ((int)usecs < 0) {
00058     usecs += MILLION;
00059     --secs;
00060   }
00061   if ((int)secs < 0)
00062     return DELAY_ZERO;
00063   else
00064     return DelayInterval(secs, usecs);
00065 }

EventTime TimeNow (  ) 

Definition at line 222 of file DelayQueue.cpp.

References NULL.

Referenced by DelayQueue::DelayQueue(), and DelayQueue::synchronize().

00222                     {
00223   struct timeval tvNow;
00224 
00225   gettimeofday(&tvNow, NULL);
00226 
00227   return EventTime(tvNow.tv_sec, tvNow.tv_usec);
00228 }


Variable Documentation

const DelayInterval DELAY_SECOND(1, 0)

const DelayInterval DELAY_ZERO(0, 0)

Referenced by DelayQueue::handleAlarm(), operator-(), DelayQueue::synchronize(), and DelayQueue::timeToNextAlarm().

const DelayInterval ETERNITY(INT_MAX, MILLION-1)

const int MILLION = 1000000 [static]

Definition at line 24 of file DelayQueue.cpp.

const EventTime THE_END_OF_TIME(INT_MAX)


Generated on Thu Feb 2 23:51:33 2012 for live by  doxygen 1.5.2