]> git.mxchange.org Git - flightgear.git/commitdiff
Moved Time/timestamp.hxx into simgear/timing/timestamp.hxx
authorcurt <curt>
Thu, 30 Nov 2000 18:43:31 +0000 (18:43 +0000)
committercurt <curt>
Thu, 30 Nov 2000 18:43:31 +0000 (18:43 +0000)
src/Cockpit/panel.hxx
src/FDM/flight.cxx
src/FDM/flight.hxx
src/Main/fg_io.cxx
src/Time/Makefile.am
src/Time/event.cxx
src/Time/event.hxx
src/Time/fg_timer.cxx
src/Time/timestamp.hxx [deleted file]

index c8e8c606cefb8fa6e514894f3a002bbfab38752c..38a7725eeda67c7e21555ecd569e05da25de4e6e 100644 (file)
 #include <plib/ssg.h>
 
 #include <simgear/misc/props.hxx>
+#include <simgear/timing/timestamp.hxx>
 
 #include <vector>
 #include <map>
 #include <plib/fnt.h>
 
-#include <Time/timestamp.hxx>
 
 FG_USING_STD(vector);
 FG_USING_STD(map);
@@ -540,8 +540,8 @@ private:
   float _pointSize;
 
   mutable string _value;
-  mutable FGTimeStamp _then;
-  mutable FGTimeStamp _now;
+  mutable SGTimeStamp _then;
+  mutable SGTimeStamp _now;
 };
 
 
index b16798b2904c97f7d51107b5c35f774b2047c326..d0271bcd7731ceb0f83a619ed18a8aba22e972bb 100644 (file)
 #include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/math/sg_geodesy.hxx>
+#include <simgear/timing/timestamp.hxx>
 
 #include <Scenery/scenery.hxx>
 #include <FDM/LaRCsim/ls_interface.h>
 #include <Main/globals.hxx>
-#include <Time/timestamp.hxx>
 
 #include "External.hxx"
 #include "flight.hxx"
index 02bb1c250a7db0eb4911a2819bac4aa58b4affde..306611fa4d7cfce08eabee8a4370b12e9aca58c3 100644 (file)
@@ -88,7 +88,7 @@
 #include <list>
 #include <vector>
 
-#include <Time/timestamp.hxx>
+#include <simgear/timing/timestamp.hxx>
 
 FG_USING_STD(list);
 FG_USING_STD(vector);
@@ -252,8 +252,8 @@ private:
     // Engine list
     engine_list engines;
 
-    FGTimeStamp valid_stamp;          // time this record is valid
-    FGTimeStamp next_stamp;           // time this record is valid
+    SGTimeStamp valid_stamp;          // time this record is valid
+    SGTimeStamp next_stamp;           // time this record is valid
 
 protected:
     void _busdump(void);
@@ -974,7 +974,7 @@ public:
 
     inline double get_Climb_Rate() const { return climb_rate; }
 
-    inline FGTimeStamp get_time_stamp() const { return valid_stamp; }
+    inline SGTimeStamp get_time_stamp() const { return valid_stamp; }
     inline void stamp_time() { valid_stamp = next_stamp; next_stamp.stamp(); }
 
     // Extrapolate FDM based on time_offset (in usec)
index aa4b280cf0c710591129730fc2748c84edc0e70c..a4b8f97c2ce171c9a19fb9c77f6e3080b8eec72c 100644 (file)
@@ -31,6 +31,7 @@
 #include <simgear/io/sg_serial.hxx>
 #include <simgear/io/sg_socket.hxx>
 #include <simgear/math/sg_types.hxx>
+#include <simgear/timing/timestamp.hxx>
 
 #include <Network/protocol.hxx>
 #include <Network/native.hxx>
@@ -42,8 +43,6 @@
 #include <Network/rul.hxx>
 #include <Network/joyclient.hxx>
 
-#include <Time/timestamp.hxx>
-
 #include "globals.hxx"
 
 FG_USING_STD(string);
@@ -228,8 +227,8 @@ void fgIOProcess() {
 
     static int inited = 0;
     int interval;
-    static FGTimeStamp last;
-    FGTimeStamp current;
+    static SGTimeStamp last;
+    SGTimeStamp current;
 
     if ( ! inited ) {
        inited = 1;
index 73ab68e0fd188f9419199bc7e32a32421fbd3521..cf008a448d895a215b28c41fd8d7a415b23bfc29 100644 (file)
@@ -6,7 +6,6 @@ libTime_a_SOURCES = \
        light.cxx light.hxx \
        moonpos.cxx moonpos.hxx \
        sunpos.cxx sunpos.hxx \
-       timestamp.hxx \
        tmp.cxx tmp.hxx
        # fg_time.cxx fg_time.hxx \
        # geocoord.cxx geocoord.h \
index 4b9169af0a55529b32f9c4f606619a8f5d3597ee..1282bafbec6f85718fe8e01eb6a063d18302b5d5 100644 (file)
@@ -253,7 +253,7 @@ fgEVENT_MGR::PrintStats()
 // the queue
 void fgEVENT_MGR::Process( void ) {
     fgEVENT *e_ptr;
-    FGTimeStamp cur_time;
+    SGTimeStamp cur_time;
     unsigned int i, size;
 
     FG_LOG( FG_EVENT, FG_DEBUG, "Processing events" );
index c99fc357f5c07039522225ccd360353dae238cdf..2d5cf39450d6983b6fd8ca6865e4032cba06fd9d 100644 (file)
@@ -31,6 +31,7 @@
 
 
 #include <simgear/compiler.h>
+#include <simgear/timing/timestamp.hxx>
 
 #include <Include/fg_callback.hxx>
 
@@ -38,7 +39,6 @@
 #include <list>         // STL list
 #include STL_STRING
 
-#include "timestamp.hxx"
 
 FG_USING_STD(deque);
 FG_USING_STD(list);
@@ -87,9 +87,9 @@ private:
 
     long interval;    // interval in ms between each iteration of this event
 
-    FGTimeStamp last_run;
-    FGTimeStamp current;
-    FGTimeStamp next_run;
+    SGTimeStamp last_run;
+    SGTimeStamp current;
+    SGTimeStamp next_run;
 
     long cum_time;    // cumulative processor time of this event
     long min_time;    // time of quickest execution
index 192a95180af9b99ec2d2e591c1db29702dbe5cc7..b98184070937277495d335848909518de5fbd274 100644 (file)
@@ -36,8 +36,9 @@
 #  include <sys/time.h>  // for get/setitimer, gettimeofday, struct timeval
 #endif
 
+#include <simgear/timing/timestamp.hxx>
+
 #include "fg_timer.hxx"
-#include "timestamp.hxx"
 
 
 unsigned long int fgSimTime;
@@ -99,8 +100,8 @@ void fgTimerInit(float dt, void (*f)( int )) {
 int fgGetTimeInterval( void ) {
     int interval;
     static int inited = 0;
-    static FGTimeStamp last;
-    FGTimeStamp current;
+    static SGTimeStamp last;
+    SGTimeStamp current;
 
     
     if ( ! inited ) {
diff --git a/src/Time/timestamp.hxx b/src/Time/timestamp.hxx
deleted file mode 100644 (file)
index 563b8f4..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-// timestamp.hxx -- class for managing a timestamp (seconds & milliseconds.)
-//
-// Written by Curtis Olson, started December 1998.
-//
-// Copyright (C) 1998  Curtis L. Olson  - curt@flightgear.org
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-// This program 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 GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-// $Id$
-
-
-#ifndef _TIMESTAMP_HXX
-#define _TIMESTAMP_HXX
-
-
-#ifndef __cplusplus                                                          
-# error This library requires C++
-#endif                                   
-
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-#ifdef HAVE_WINDOWS_H
-#  include <windows.h>
-#endif
-
-#include <simgear/compiler.h>
-
-#ifdef FG_HAVE_STD_INCLUDES
-#  include <ctime>
-#else
-#  include <time.h>
-#endif
-
-#ifdef HAVE_SYS_TIMEB_H
-#  include <sys/timeb.h> // for ftime() and struct timeb
-#endif
-#ifdef HAVE_UNISTD_H
-#  include <unistd.h>    // for gettimeofday()
-#endif
-#ifdef HAVE_SYS_TIME_H
-#  include <sys/time.h>  // for get/setitimer, gettimeofday, struct timeval
-#endif
-
-// -dw- want to use metrowerks time.h
-#ifdef macintosh
-#  include <time.h>
-#  include <timer.h>
-#endif
-
-#ifdef WIN32
-#  include <windows.h>
-#  if defined( __CYGWIN__ ) || defined( __CYGWIN32__ )
-#    define NEAR /* */
-#    define FAR  /* */
-#  endif
-#  include <mmsystem.h>
-#endif
-
-// MSVC++ 6.0 kuldge - Need forward declaration of friends.
-class FGTimeStamp;
-FGTimeStamp operator + (const FGTimeStamp& t, const long& m);
-long operator - (const FGTimeStamp& a, const FGTimeStamp& b);
-
-class FGTimeStamp {
-
-private:
-
-    long seconds;
-    long usec;
-
-public:
-
-    FGTimeStamp();
-    FGTimeStamp( const long s, const long m );
-    ~FGTimeStamp();
-
-    // Set time to current time
-    void stamp();
-
-    FGTimeStamp& operator = ( const FGTimeStamp& t );
-
-    friend FGTimeStamp operator + (const FGTimeStamp& t, const long& m);
-    friend long operator - (const FGTimeStamp& a, const FGTimeStamp& b);
-
-    inline long get_seconds() const { return seconds; }
-    // inline long get_usec() const { return usec; }
-};
-
-inline FGTimeStamp::FGTimeStamp() {
-}
-
-inline FGTimeStamp::FGTimeStamp( const long s, const long u ) {
-    seconds = s;
-    usec = u;
-}
-
-inline FGTimeStamp::~FGTimeStamp() {
-}
-
-inline FGTimeStamp& FGTimeStamp::operator = (const FGTimeStamp& t)
-{
-    seconds = t.seconds;
-    usec = t.usec;
-    return *this;
-}
-
-inline void FGTimeStamp::stamp() {
-#if defined( WIN32 )
-    unsigned int t;
-    t = timeGetTime();
-    seconds = 0;
-    usec =  t * 1000;
-#elif defined( HAVE_GETTIMEOFDAY )
-    struct timeval current;
-    struct timezone tz;
-    // fg_timestamp currtime;
-    gettimeofday(&current, &tz);
-    seconds = current.tv_sec;
-    usec = current.tv_usec;
-#elif defined( HAVE_GETLOCALTIME )
-    SYSTEMTIME current;
-    GetLocalTime(&current);
-    seconds = current.wSecond;
-    usec = current.wMilliseconds * 1000;
-#elif defined( HAVE_FTIME )
-    struct timeb current;
-    ftime(&current);
-    seconds = current.time;
-    usec = current.millitm * 1000;
-// -dw- uses time manager
-#elif defined( macintosh )
-    UnsignedWide ms;
-    Microseconds(&ms);
-       
-    seconds = ms.lo / 1000000;
-    usec = ms.lo - ( seconds * 1000000 );
-#else
-# error Port me
-#endif
-}
-
-// increment the time stamp by the number of microseconds (usec)
-inline FGTimeStamp operator + (const FGTimeStamp& t, const long& m) {
-#ifdef WIN32
-    return FGTimeStamp( 0, t.usec + m );
-#else
-    return FGTimeStamp( t.seconds + ( t.usec + m ) / 1000000,
-                       ( t.usec + m ) % 1000000 );
-#endif
-}
-
-// difference between time stamps in microseconds (usec)
-inline long operator - (const FGTimeStamp& a, const FGTimeStamp& b)
-{
-#if defined( WIN32 )
-    return a.usec - b.usec;
-#else
-    return 1000000 * (a.seconds - b.seconds) + (a.usec - b.usec);
-#endif
-}
-
-
-#endif // _TIMESTAMP_HXX
-
-