mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
*** empty log message ***
This commit is contained in:
parent
5e859746ad
commit
2b5709f63a
@ -52,3 +52,20 @@ tick() {
|
|||||||
|
|
||||||
_frame_count++;
|
_frame_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: TimeVal::contructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
TimeVal::
|
||||||
|
TimeVal(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: get_time_of_day
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void get_time_of_day(TimeVal &tv) {
|
||||||
|
get_true_time_of_day(tv.tv[0], tv.tv[1]);
|
||||||
|
}
|
||||||
|
@ -11,6 +11,18 @@
|
|||||||
#include "trueClock.h"
|
#include "trueClock.h"
|
||||||
#include "config_express.h"
|
#include "config_express.h"
|
||||||
|
|
||||||
|
class EXPCL_PANDAEXPRESS TimeVal {
|
||||||
|
PUBLISHED:
|
||||||
|
TimeVal();
|
||||||
|
ulong tv[2];
|
||||||
|
};
|
||||||
|
|
||||||
|
BEGIN_PUBLISH
|
||||||
|
|
||||||
|
EXPCL_PANDAEXPRESS void get_time_of_day(TimeVal &tv);
|
||||||
|
|
||||||
|
END_PUBLISH
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Class : ClockObject
|
// Class : ClockObject
|
||||||
// Description : A ClockObject keeps track of elapsed real time and
|
// Description : A ClockObject keeps track of elapsed real time and
|
||||||
|
@ -29,6 +29,12 @@ static PN_int64 _frequency;
|
|||||||
static PN_int64 _init_count;
|
static PN_int64 _init_count;
|
||||||
static long _init_sec;
|
static long _init_sec;
|
||||||
|
|
||||||
|
void get_true_time_of_day(ulong &sec, ulong &usec) {
|
||||||
|
struct timeb tb;
|
||||||
|
ftime(&tb);
|
||||||
|
sec = tb.time;
|
||||||
|
usec = (ulong)(tb.millitm * 1000.0);
|
||||||
|
}
|
||||||
|
|
||||||
double TrueClock::
|
double TrueClock::
|
||||||
get_real_time() const {
|
get_real_time() const {
|
||||||
@ -105,6 +111,10 @@ timer_handler(int) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void get_true_time_of_day(ulong &sec, ulong &msec) {
|
||||||
|
cerr << "get_true_time_of_day() not implemented!" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
double TrueClock::
|
double TrueClock::
|
||||||
get_real_time() const {
|
get_real_time() const {
|
||||||
return (double) _sec + ((double) _msec / 1000.0);
|
return (double) _sec + ((double) _msec / 1000.0);
|
||||||
@ -146,6 +156,25 @@ TrueClock() {
|
|||||||
|
|
||||||
static long _init_sec;
|
static long _init_sec;
|
||||||
|
|
||||||
|
void get_true_time_of_day(ulong &sec, ulong &msec) {
|
||||||
|
struct timeval tv;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
#ifdef GETTIMEOFDAY_ONE_PARAM
|
||||||
|
result = gettimeofday(&tv);
|
||||||
|
#else
|
||||||
|
result = gettimeofday(&tv, (struct timezone *)NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (result < 0) {
|
||||||
|
sec = 0;
|
||||||
|
msec = 0;
|
||||||
|
// Error in gettimeofday().
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sec = tv.tv_sec;
|
||||||
|
msec = tv.tv_usec;
|
||||||
|
}
|
||||||
|
|
||||||
double TrueClock::
|
double TrueClock::
|
||||||
get_real_time() const {
|
get_real_time() const {
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#define TRUECLOCK_H
|
#define TRUECLOCK_H
|
||||||
|
|
||||||
#include <pandabase.h>
|
#include <pandabase.h>
|
||||||
|
#include "typedef.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Class : TrueClock
|
// Class : TrueClock
|
||||||
@ -34,6 +35,8 @@ protected:
|
|||||||
static TrueClock *_global_ptr;
|
static TrueClock *_global_ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void get_true_time_of_day(ulong &sec, ulong &usec);
|
||||||
|
|
||||||
#include "trueClock.I"
|
#include "trueClock.I"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user