00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OpenSpace3D 00004 For the latest info, see http://www.openspace3d.com 00005 00006 Copyright (c) 2010 I-maginer 00007 00008 This program is free software; you can redistribute it and/or modify it under 00009 the terms of the GNU Lesser General Public License as published by the Free Software 00010 Foundation; either version 2 of the License, or (at your option) any later 00011 version. 00012 00013 This program is distributed in the hope that it will be useful, but WITHOUT 00014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00015 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public License along with 00018 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00019 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00020 http://www.gnu.org/copyleft/lesser.txt 00021 00022 You may alternatively use this source under the terms of a specific version of 00023 the OpenSpace3D Unrestricted License provided you have obtained such a license from 00024 I-maginer. 00025 ----------------------------------------------------------------------------- 00026 */ 00027 00028 /* 00029 Taken from Caelum (http://www.ogre3d.org/wiki/index.php/Caelum) 00030 */ 00031 00032 #ifndef __SO3_UNIVERSALCLOCK_H__ 00033 #define __SO3_UNIVERSALCLOCK_H__ 00034 00035 #include "SO3Astronomy.h" 00036 00037 namespace SO3 00038 { 00039 00048 class _SO3_Export SUniversalClock 00049 { 00050 public: 00051 static const double SECONDS_PER_DAY; 00052 protected: 00053 private: 00054 double mJulianDayBase; 00055 double mCurrentTime; 00056 double mLastUpdateTime; 00057 float mTimeScale; 00058 00059 public: 00063 SUniversalClock(); 00064 00069 void SetTimeScale(const float scale); 00070 00075 float GetTimeScale() const; 00076 00081 void Update(const float time); 00082 00088 void SetJulianDay(double value); 00089 00094 void SetGregorianDateTime(int year, int month, int day, int hour, int minute, double second); 00095 00098 void GetGregorianDateTime(int& year, int& month, int& day, int& hour, int& minute, double& second); 00099 00103 double GetJulianDay() const; 00104 00109 double GetJulianDayDifference() const; 00110 00115 double GetJulianSecond() const; 00116 00121 double GetJulianSecondDifference() const; 00122 }; 00123 00124 } 00125 00126 #endif
1.6.3