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 ()
DelayInterval TimeRemainingUntil (EventTime const &futureEvent)

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 69 of file DelayQueue.cpp.

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

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

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

Definition at line 52 of file DelayQueue.cpp.

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

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

EventTime TimeNow (  ) 

Definition at line 212 of file DelayQueue.cpp.

References NULL.

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

00212                     {
00213   struct timeval tvNow;
00214 
00215   gettimeofday(&tvNow, NULL);
00216 
00217   return EventTime(tvNow.tv_sec, tvNow.tv_usec);
00218 }

DelayInterval TimeRemainingUntil ( EventTime const &  futureEvent  ) 

Definition at line 220 of file DelayQueue.cpp.

References TimeNow().

00220                                                                {
00221   return futureEvent - TimeNow();
00222 }


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 Tue Oct 7 15:38:12 2008 for live by  doxygen 1.5.2