Caelum::UniversalClock Class Reference

The system's time model. More...

#include <UniversalClock.h>

List of all members.

Public Member Functions

 UniversalClock ()
 Constructor.
void setTimeScale (const Ogre::Real scale)
 Sets the time scale.
Ogre::Real getTimeScale () const
 Gets the time scale.
void update (const Ogre::Real time)
 Updates the clock.
void setJulianDay (LongReal value)
 Set the current time as a julian day.
void setGregorianDateTime (int year, int month, int day, int hour, int minute, double second)
 Set the current time as a gregorian date.
LongReal getJulianDay () const
 Get current julian day.
LongReal getJulianDayDifference () const
 Get the difference in julian day between this and the last update.
LongReal getJulianSecond () const
 Get the current julian second (getJulianDay * SECONDS_PER_DAY) This is most likely very very large and unprecise.
LongReal getJulianSecondDifference () const
 Get the difference in seconds between this and the last update.

Static Public Attributes

static const LongReal SECONDS_PER_DAY = 86400.0
 Number of seconds per day; exactly 60*60*24.


Detailed Description

The system's time model.

This class is responsible of keeping track of current astronomical time and syncronising with ogre time.

It maintains a snapshot point: At mCurrentTime == 0 julian day was mJulianDayBase. At any time the julian day can be calculated from mCurrentTime and mJulianDayBase. This increases precission; mCurrentTime is tracked in seconds while mJulianDayBase uses days. It would be silly to track the current time in days.

Definition at line 37 of file UniversalClock.h.


Member Function Documentation

void Caelum::UniversalClock::setTimeScale ( const Ogre::Real  scale  ) 

Sets the time scale.

Parameters:
scale The new time scale. If negative, time will move backwards; 2.0 means double speed...

Definition at line 71 of file UniversalClock.cpp.

Referenced by UniversalClock().

Ogre::Real Caelum::UniversalClock::getTimeScale (  )  const

Gets the time scale.

Returns:
The current time scale. Defaults to 1.

Definition at line 75 of file UniversalClock.cpp.

void Caelum::UniversalClock::update ( const Ogre::Real  time  ) 

Updates the clock.

Parameters:
time The time to be added to the clock. It will beaffected by the time scale.

Definition at line 79 of file UniversalClock.cpp.

void Caelum::UniversalClock::setJulianDay ( Caelum::LongReal  value  ) 

Set the current time as a julian day.

Set the current time as a julian day, which you build using one of the static getJulianDayFromXXX functions. Defaults to J2000 (noon january 1st)

Definition at line 34 of file UniversalClock.cpp.

Referenced by setGregorianDateTime(), and UniversalClock().

void Caelum::UniversalClock::setGregorianDateTime ( int  year,
int  month,
int  day,
int  hour,
int  minute,
double  second 
)

Set the current time as a gregorian date.

This is here as an easy to use function.

Definition at line 40 of file UniversalClock.cpp.

References Caelum::Astronomy::getJulianDayFromGregorianDateTime(), and setJulianDay().

LongReal Caelum::UniversalClock::getJulianDayDifference (  )  const

Get the difference in julian day between this and the last update.

This is most likely very small and unprecise.

Definition at line 55 of file UniversalClock.cpp.

References SECONDS_PER_DAY.

LongReal Caelum::UniversalClock::getJulianSecondDifference (  )  const

Get the difference in seconds between this and the last update.

This is what you want for per-frame updates.

Definition at line 66 of file UniversalClock.cpp.


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

Generated on Sun Aug 9 10:24:22 2009 for Caelum by  doxygen 1.5.9