BasicUsageEnvironment/include/DelayQueue.hh File Reference

#include "NetCommon.h"

Include dependency graph for DelayQueue.hh:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  Timeval
class  DelayInterval
class  EventTime
class  DelayQueueEntry
class  DelayQueue

Typedefs

typedef long time_base_seconds

Functions

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

Variables

DelayInterval const DELAY_ZERO
DelayInterval const DELAY_SECOND
DelayInterval const DELAY_MINUTE = 60*DELAY_SECOND
DelayInterval const DELAY_HOUR = 60*DELAY_MINUTE
DelayInterval const DELAY_DAY = 24*DELAY_HOUR
EventTime const THE_END_OF_TIME


Typedef Documentation

typedef long time_base_seconds

Definition at line 30 of file DelayQueue.hh.


Function Documentation

Timeval max ( Timeval const &  arg1,
Timeval const &  arg2 
) [inline]

Definition at line 88 of file DelayQueue.hh.

00088                                                              {
00089   return arg1 >= arg2 ? arg1 : arg2;
00090 }

Timeval min ( Timeval const &  arg1,
Timeval const &  arg2 
) [inline]

Definition at line 93 of file DelayQueue.hh.

00093                                                              {
00094   return arg1 <= arg2 ? arg1 : arg2;
00095 }

DelayInterval operator * ( short  arg1,
DelayInterval const &  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 }

class DelayInterval operator- ( Timeval const &  arg1,
Timeval const &  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

DelayInterval const DELAY_DAY = 24*DELAY_HOUR

Definition at line 116 of file DelayQueue.hh.

DelayInterval const DELAY_HOUR = 60*DELAY_MINUTE

Definition at line 115 of file DelayQueue.hh.

DelayInterval const DELAY_MINUTE = 60*DELAY_SECOND

Definition at line 114 of file DelayQueue.hh.

DelayInterval const DELAY_SECOND

DelayInterval const DELAY_ZERO

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

EventTime const THE_END_OF_TIME


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