00001 00006 // Written by Curtis Olson, started December 1998. 00007 // 00008 // Copyright (C) 1998 Curtis L. Olson - http://www.flightgear.org/~curt 00009 // 00010 // This program is free software; you can redistribute it and/or 00011 // modify it under the terms of the GNU General Public License as 00012 // published by the Free Software Foundation; either version 2 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This program is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU General Public License 00021 // along with this program; if not, write to the Free Software 00022 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00023 // 00024 // $Id: timestamp_8hxx-source.html,v 1.15 2007-12-17 15:37:16 curt Exp $ 00025 00026 00027 #ifndef _TIMESTAMP_HXX 00028 #define _TIMESTAMP_HXX 00029 00030 00031 #ifndef __cplusplus 00032 # error This library requires C++ 00033 #endif 00034 00035 00036 #include <simgear/compiler.h> 00037 00038 00039 // MSVC++ 6.0 kuldge - Need forward declaration of friends. 00040 class SGTimeStamp; 00041 SGTimeStamp operator + (const SGTimeStamp& t, const long& m); 00042 long operator - (const SGTimeStamp& a, const SGTimeStamp& b); 00043 00054 class SGTimeStamp { 00055 00056 private: 00057 00058 long seconds; 00059 long usec; 00060 00061 public: 00062 00064 SGTimeStamp(); 00065 00073 SGTimeStamp( const long s, const long m ); 00074 ~SGTimeStamp(); 00075 00077 void stamp(); 00078 00080 SGTimeStamp& operator = ( const SGTimeStamp& t ); 00081 00088 friend SGTimeStamp operator + (const SGTimeStamp& t, const long& m); 00089 00096 friend long operator - (const SGTimeStamp& a, const SGTimeStamp& b); 00097 00099 inline long get_seconds() const { return seconds; } 00100 00102 inline long get_usec() const { return usec; } 00103 }; 00104 00105 inline SGTimeStamp::SGTimeStamp() : 00106 seconds(0), 00107 usec(0) 00108 { 00109 } 00110 00111 inline SGTimeStamp::SGTimeStamp( const long s, const long u ) { 00112 seconds = s; 00113 usec = u; 00114 } 00115 00116 inline SGTimeStamp::~SGTimeStamp() { 00117 } 00118 00119 inline SGTimeStamp& SGTimeStamp::operator = (const SGTimeStamp& t) 00120 { 00121 seconds = t.seconds; 00122 usec = t.usec; 00123 return *this; 00124 } 00125 00126 00127 #endif // _TIMESTAMP_HXX 00128 00129
1.5.1