00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef UNIVERSALCLOCK_H
00022 #define UNIVERSALCLOCK_H
00023
00024 #include "CaelumPrerequisites.h"
00025
00026 namespace caelum {
00027
00037 class CAELUM_EXPORT UniversalClock
00038 {
00039 private:
00041 LongReal mJulianDayBase;
00042
00044 LongReal mCurrentTime;
00045
00047 LongReal mLastUpdateTime;
00048
00051 Ogre::Real mTimeSinceLastUpdate;
00052
00054 Ogre::Real mUpdateRate;
00055
00057 Ogre::Real mTimeScale;
00058
00061 void forceUpdate();
00062
00063
00064 public:
00065 static const LongReal SECONDS_PER_DAY;
00066
00069 UniversalClock ();
00070
00074 void setTimeScale (const Ogre::Real scale);
00075
00079 Ogre::Real getTimeScale () const;
00080
00086 void setUpdateRate (const Ogre::Real rate);
00087
00091 Ogre::Real getUpdateRate () const;
00092
00098 bool update (const Ogre::Real time);
00099
00105 void setJulianDay(LongReal value);
00106
00107
00108
00109 void setGregorianDateTime(
00110 int year, int month, int day,
00111 int hour, int minute, double second);
00112
00115 LongReal getJulianDay() const;
00116
00120 LongReal getJulianDayDifference() const;
00121
00125 LongReal getJulianSecond() const;
00126
00130 LongReal getJulianSecondDifference() const;
00131 };
00132
00133 }
00134
00135 #endif //UNIVERSALCLOCK_H