Sirikata
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes
Sirikata::Task::LocalTime Class Reference

Represents an absolute system time on this machine. More...

#include <Time.hpp>

Inheritance diagram for Sirikata::Task::LocalTime:
Collaboration diagram for Sirikata::Task::LocalTime:

List of all members.

Public Member Functions

 LocalTime ()
uint64 raw () const
bool operator== (const LocalTime &other) const
 Equality comparison (same as (*this - other) == 0)
bool operator!= (const LocalTime &other) const
bool operator< (const LocalTime &other) const
 Ordering comparison (same as (*this - other) < 0)
bool operator<= (const LocalTime &other) const
bool operator> (const LocalTime &other) const
bool operator>= (const LocalTime &other) const
DeltaTime operator- (const LocalTime &other) const
 Takes the difference of two absolute times.
LocalTime operator+ (const DeltaTime &otherDelta) const
 Adds a time difference to a given absolute time.
LocalTime operator- (const DeltaTime &otherDelta) const
void operator+= (const DeltaTime &otherDelta)
void operator-= (const DeltaTime &otherDelta)

Static Public Member Functions

static LocalTime microseconds (int64 abstime)
static LocalTime now ()
 The only public construction function for absolute times.
static LocalTime epoch ()
 Creates the time when items are 0.
static LocalTime null ()
 Creates a 'null' absolute time that is equivalent to a long time ago in a galaxy far away.

Protected Member Functions

 LocalTime (uint64 t)
 Private constructor-- Use "now()" to create an LocalTime.

Private Attributes

uint64 mTime

Detailed Description

Represents an absolute system time on this machine.

Note: LocalTime is stored internally as an int64. The only two ways to create an LocalTime object are by adding to another LocalTime, and by calling LocalTime::now().

Note that as LocalTime is a local time for purposes of event processing only, there are no conversion functions, except by taking the difference of two LocalTime objects.
See also:
DeltaTime

Constructor & Destructor Documentation

Sirikata::Task::LocalTime::LocalTime ( uint64  t) [inline, explicit, protected]

Private constructor-- Use "now()" to create an LocalTime.

Sirikata::Task::LocalTime::LocalTime ( ) [inline]

Member Function Documentation

static LocalTime Sirikata::Task::LocalTime::epoch ( ) [inline, static]

Creates the time when items are 0.

Returns:
the beginning of time--so that a subtraction can be used with an actual time

Reimplemented in Sirikata::Time.

Referenced by Sirikata::Graphics::OgreRenderer::preFrame().

static LocalTime Sirikata::Task::LocalTime::microseconds ( int64  abstime) [inline, static]

Reimplemented in Sirikata::Time.

Referenced by now().

Sirikata::Task::LocalTime Sirikata::Task::LocalTime::now ( ) [static]

The only public construction function for absolute times.

Returns:
the current system time (gettimeofday), not to be used for time synchronization over the network.

References microseconds().

Referenced by Sirikata::Task::DeltaTime::fromNow(), Sirikata::Poller::handleExec(), Sirikata::Time::local(), Sirikata::Graphics::OgreSystem::poll(), Sirikata::Graphics::OgreRenderer::poll(), Sirikata::Graphics::OgreRenderer::renderOneFrame(), and Sirikata::Graphics::ResourceLoader::tick().

static LocalTime Sirikata::Task::LocalTime::null ( ) [inline, static]

Creates a 'null' absolute time that is equivalent to a long time ago in a galaxy far away.

Always less than a real time, and equal to another null() value.

Returns:
a 'null' time to be used if a timeout is not applicable.

Reimplemented in Sirikata::Time.

bool Sirikata::Task::LocalTime::operator!= ( const LocalTime other) const [inline]

References mTime.

LocalTime Sirikata::Task::LocalTime::operator+ ( const DeltaTime otherDelta) const [inline]

Adds a time difference to a given absolute time.

Returns:
a new absolute time--does not modify the existing one.

References Sirikata::Task::DeltaTime::toMicro().

void Sirikata::Task::LocalTime::operator+= ( const DeltaTime otherDelta) [inline]
DeltaTime Sirikata::Task::LocalTime::operator- ( const LocalTime other) const [inline]

Takes the difference of two absolute times.

Returns:
a DeltaTime that can be cast to a double in seconds.

References Sirikata::Task::DeltaTime::microseconds(), and mTime.

LocalTime Sirikata::Task::LocalTime::operator- ( const DeltaTime otherDelta) const [inline]
void Sirikata::Task::LocalTime::operator-= ( const DeltaTime otherDelta) [inline]
bool Sirikata::Task::LocalTime::operator< ( const LocalTime other) const [inline]

Ordering comparison (same as (*this - other) < 0)

References mTime.

bool Sirikata::Task::LocalTime::operator<= ( const LocalTime other) const [inline]

References mTime.

bool Sirikata::Task::LocalTime::operator== ( const LocalTime other) const [inline]

Equality comparison (same as (*this - other) == 0)

References mTime.

bool Sirikata::Task::LocalTime::operator> ( const LocalTime other) const [inline]

References mTime.

bool Sirikata::Task::LocalTime::operator>= ( const LocalTime other) const [inline]

References mTime.

uint64 Sirikata::Task::LocalTime::raw ( ) const [inline]

Reimplemented in Sirikata::Time.


Member Data Documentation


The documentation for this class was generated from the following files: