Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/express/trueClock.h

Go to the documentation of this file.
00001 // Filename: trueClock.h
00002 // Created by:  drose (04Jul00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef TRUECLOCK_H
00020 #define TRUECLOCK_H
00021 
00022 #include <pandabase.h>
00023 #include "typedef.h"
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //       Class : TrueClock
00027 // Description : An interface to whatever real-time clock we might
00028 //               have available in the current environment.  There is
00029 //               only one TrueClock in existence, and it constructs
00030 //               itself.
00031 //
00032 //               The TrueClock returns elapsed real time in seconds
00033 //               since some undefined epoch.  Since it is not defined
00034 //               at what time precisely the clock indicates zero, this
00035 //               value can only be meaningfully used to measure
00036 //               elapsed time, by sampling it at two different times
00037 //               and subtracting.
00038 ////////////////////////////////////////////////////////////////////
00039 class EXPCL_PANDAEXPRESS TrueClock {
00040 public:
00041   INLINE static TrueClock *get_ptr();
00042 
00043   // get_long_time() returns the most accurate timer we have over a
00044   // long interval.  It may not be very precise for measuring short
00045   // intervals, but it should not drift substantially over the long
00046   // haul.
00047   double get_long_time() const;
00048 
00049   // get_short_time() returns the most precise timer we have over a
00050   // short interval.  It may tend to drift over the long haul, but it
00051   // should have lots of digits to measure short intervals very
00052   // precisely.
00053   double get_short_time() const;
00054 
00055 protected:
00056   TrueClock();
00057   INLINE ~TrueClock();
00058 
00059   static TrueClock *_global_ptr;
00060 };
00061 
00062 void get_true_time_of_day(ulong &sec, ulong &usec);
00063 
00064 #include "trueClock.I"
00065 
00066 #endif

Generated on Fri May 2 00:38:42 2003 for Panda by doxygen1.3