2006-07-18 23:21:48 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
2003-01-22 00:45:36 +08:00
|
|
|
*
|
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
2001-09-20 07:52:12 +08:00
|
|
|
#include <osg/FrameStamp>
|
|
|
|
|
|
|
|
using namespace osg;
|
|
|
|
|
2007-08-22 17:42:27 +08:00
|
|
|
FrameStamp::FrameStamp():Referenced(true)
|
2001-09-20 07:52:12 +08:00
|
|
|
{
|
2002-07-21 06:40:24 +08:00
|
|
|
_frameNumber=0;
|
|
|
|
_referenceTime=0;
|
2007-01-25 20:02:51 +08:00
|
|
|
_simulationTime=0;
|
2002-07-21 06:40:24 +08:00
|
|
|
|
|
|
|
tm_sec=0; /* Seconds. [0-60] (1 leap second) */
|
|
|
|
tm_min=0; /* Minutes. [0-59] */
|
|
|
|
tm_hour=0; /* Hours. [0-23] */
|
|
|
|
tm_mday=0; /* Day. [1-31] */
|
|
|
|
tm_mon=0; /* Month. [0-11] */
|
|
|
|
tm_year=0; /* Year - 1900. */
|
|
|
|
tm_wday=0; /* Day of week. [0-6] */
|
|
|
|
tm_yday=0; /* Days in year. [0-365] */
|
|
|
|
tm_isdst=0; /* DST. [-1/0/1]*/
|
|
|
|
|
2001-09-20 07:52:12 +08:00
|
|
|
}
|
|
|
|
|
2007-08-22 17:42:27 +08:00
|
|
|
FrameStamp::FrameStamp(const FrameStamp& fs):Referenced(true)
|
2001-09-20 07:52:12 +08:00
|
|
|
{
|
|
|
|
_frameNumber = fs._frameNumber;
|
|
|
|
_referenceTime = fs._referenceTime;
|
|
|
|
|
|
|
|
tm_sec = fs.tm_sec; /* Seconds. [0-60] (1 leap second) */
|
|
|
|
tm_min = fs.tm_min; /* Minutes. [0-59] */
|
|
|
|
tm_hour = fs.tm_hour; /* Hours. [0-23] */
|
|
|
|
tm_mday = fs.tm_mday; /* Day. [1-31] */
|
|
|
|
tm_mon = fs.tm_mon; /* Month. [0-11] */
|
|
|
|
tm_year = fs.tm_year; /* Year - 1900. */
|
|
|
|
tm_wday = fs.tm_wday; /* Day of week. [0-6] */
|
|
|
|
tm_yday = fs.tm_yday; /* Days in year.[0-365] */
|
|
|
|
tm_isdst = fs.tm_isdst; /* DST. [-1/0/1]*/
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
FrameStamp::~FrameStamp()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
FrameStamp& FrameStamp::operator = (const FrameStamp& fs)
|
|
|
|
{
|
|
|
|
if (this==&fs) return *this;
|
|
|
|
|
|
|
|
_frameNumber = fs._frameNumber;
|
|
|
|
_referenceTime = fs._referenceTime;
|
|
|
|
|
|
|
|
tm_sec = fs.tm_sec; /* Seconds. [0-60] (1 leap second) */
|
|
|
|
tm_min = fs.tm_min; /* Minutes. [0-59] */
|
|
|
|
tm_hour = fs.tm_hour; /* Hours. [0-23] */
|
|
|
|
tm_mday = fs.tm_mday; /* Day. [1-31] */
|
|
|
|
tm_mon = fs.tm_mon; /* Month. [0-11] */
|
|
|
|
tm_year = fs.tm_year; /* Year - 1900. */
|
|
|
|
tm_wday = fs.tm_wday; /* Day of week. [0-6] */
|
|
|
|
tm_yday = fs.tm_yday; /* Days in year.[0-365] */
|
|
|
|
tm_isdst = fs.tm_isdst; /* DST. [-1/0/1]*/
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2002-05-23 03:58:43 +08:00
|
|
|
void FrameStamp::setCalendarTime(const tm& ct)
|
2001-09-20 07:52:12 +08:00
|
|
|
{
|
|
|
|
tm_sec = ct.tm_sec; /* Seconds. [0-60] (1 leap second) */
|
|
|
|
tm_min = ct.tm_min; /* Minutes. [0-59] */
|
|
|
|
tm_hour = ct.tm_hour; /* Hours. [0-23] */
|
|
|
|
tm_mday = ct.tm_mday; /* Day. [1-31] */
|
|
|
|
tm_mon = ct.tm_mon; /* Month. [0-11] */
|
|
|
|
tm_year = ct.tm_year; /* Year - 1900. */
|
|
|
|
tm_wday = ct.tm_wday; /* Day of week. [0-6] */
|
|
|
|
tm_yday = ct.tm_yday; /* Days in year.[0-365] */
|
|
|
|
tm_isdst = ct.tm_isdst; /* DST. [-1/0/1]*/
|
|
|
|
}
|
|
|
|
|
2002-05-23 03:58:43 +08:00
|
|
|
void FrameStamp::getCalendarTime(tm& ct) const
|
2001-09-20 07:52:12 +08:00
|
|
|
{
|
|
|
|
ct.tm_sec = tm_sec; /* Seconds. [0-60] (1 leap second) */
|
|
|
|
ct.tm_min = tm_min; /* Minutes. [0-59] */
|
|
|
|
ct.tm_hour = tm_hour; /* Hours. [0-23] */
|
|
|
|
ct.tm_mday = tm_mday; /* Day. [1-31] */
|
|
|
|
ct.tm_mon = tm_mon; /* Month. [0-11] */
|
|
|
|
ct.tm_year = tm_year; /* Year - 1900. */
|
|
|
|
ct.tm_wday = tm_wday; /* Day of week. [0-6] */
|
|
|
|
ct.tm_yday = tm_yday; /* Days in year.[0-365] */
|
|
|
|
ct.tm_isdst = tm_isdst; /* DST. [-1/0/1]*/
|
|
|
|
}
|