Changed GetMilliseconds() to return a 64-bit value
This function previously returned an int32_t. Presuming that it measures the length of time since the application was started, the 32-bit type would cause the returned value to wrap from 2^31-1 to -2^31 after a little less than twenty-five days.pull/3/head
parent
873811d865
commit
7ca137f5fe
|
@ -179,13 +179,13 @@ void SolveSpace::GenerateAll(int first, int last, bool andFindFree) {
|
|||
SK.param.MoveSelfInto(&prev);
|
||||
SK.entity.Clear();
|
||||
|
||||
int32_t inTime = GetMilliseconds();
|
||||
int64_t inTime = GetMilliseconds();
|
||||
|
||||
bool displayedStatusMessage = false;
|
||||
for(i = 0; i < SK.group.n; i++) {
|
||||
Group *g = &(SK.group.elem[i]);
|
||||
|
||||
int32_t now = GetMilliseconds();
|
||||
int64_t now = GetMilliseconds();
|
||||
// Display the status message if we've taken more than 400 ms, or
|
||||
// if we've taken 200 ms but we're not even halfway done, or if
|
||||
// we've already started displaying the status message.
|
||||
|
|
|
@ -263,7 +263,7 @@ void GraphicsWindow::AnimateOnto(Quaternion quatf, Vector offsetf) {
|
|||
// long translations (as measured in pixels) if the user zooms out, moves,
|
||||
// and then zooms in again.
|
||||
if(dt > 2000) dt = 2000;
|
||||
int32_t tn, t0 = GetMilliseconds();
|
||||
int64_t tn, t0 = GetMilliseconds();
|
||||
double s = 0;
|
||||
Quaternion dq = quatf.Times(quat0.Inverse());
|
||||
do {
|
||||
|
|
|
@ -1291,7 +1291,7 @@ void GraphicsWindow::SpaceNavigatorMoved(double tx, double ty, double tz,
|
|||
// If we go five seconds without SpaceNavigator input, or if we've
|
||||
// switched groups, then consider that a new action and save an undo
|
||||
// point.
|
||||
int32_t now = GetMilliseconds();
|
||||
int64_t now = GetMilliseconds();
|
||||
if(now - lastSpaceNavigatorTime > 5000 ||
|
||||
lastSpaceNavigatorGroup.v != g->h.v)
|
||||
{
|
||||
|
|
|
@ -208,7 +208,7 @@ void ToggleFullScreen(void);
|
|||
bool FullScreenIsActive(void);
|
||||
void GetGraphicsWindowSize(int *w, int *h);
|
||||
void GetTextWindowSize(int *w, int *h);
|
||||
int32_t GetMilliseconds(void);
|
||||
int64_t GetMilliseconds(void);
|
||||
int64_t GetUnixTime(void);
|
||||
|
||||
void dbp(const char *str, ...);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
void SPolygon::UvTriangulateInto(SMesh *m, SSurface *srf) {
|
||||
if(l.n <= 0) return;
|
||||
|
||||
int32_t in = GetMilliseconds();
|
||||
//int64_t in = GetMilliseconds();
|
||||
|
||||
normal = Vector::From(0, 0, 1);
|
||||
|
||||
|
@ -67,7 +67,7 @@ void SPolygon::UvTriangulateInto(SMesh *m, SSurface *srf) {
|
|||
}
|
||||
}
|
||||
|
||||
// dbp("finished finding holes: %d ms", GetMilliseconds() - in);
|
||||
// dbp("finished finding holes: %d ms", (int)(GetMilliseconds() - in));
|
||||
for(;;) {
|
||||
double xmin = 1e10;
|
||||
SContour *scmin = NULL;
|
||||
|
@ -86,13 +86,13 @@ void SPolygon::UvTriangulateInto(SMesh *m, SSurface *srf) {
|
|||
dbp("couldn't merge our hole");
|
||||
return;
|
||||
}
|
||||
// dbp(" bridged to contour: %d ms", GetMilliseconds() - in);
|
||||
// dbp(" bridged to contour: %d ms", (int)(GetMilliseconds() - in));
|
||||
scmin->tag = 3;
|
||||
}
|
||||
// dbp("finished merging holes: %d ms", GetMilliseconds() - in);
|
||||
// dbp("finished merging holes: %d ms", (int)(GetMilliseconds() - in));
|
||||
|
||||
merged.UvTriangulateInto(m, srf);
|
||||
// dbp("finished ear clippping: %d ms", GetMilliseconds() - in);
|
||||
// dbp("finished ear clippping: %d ms", (int)(GetMilliseconds() - in));
|
||||
merged.l.Clear();
|
||||
el.Clear();
|
||||
vl.Clear();
|
||||
|
|
4
ui.h
4
ui.h
|
@ -636,7 +636,7 @@ public:
|
|||
CMNU_FIRST_STYLE = 0x40000000
|
||||
};
|
||||
void ContextMenuListStyles(void);
|
||||
int32_t contextMenuCancelTime;
|
||||
int64_t contextMenuCancelTime;
|
||||
|
||||
// The toolbar, in toolbar.cpp
|
||||
bool ToolbarDrawOrHitTest(int x, int y, bool paint, int *menuHit);
|
||||
|
@ -683,7 +683,7 @@ public:
|
|||
bool KeyDown(int c);
|
||||
void EditControlDone(const char *s);
|
||||
|
||||
int32_t lastSpaceNavigatorTime;
|
||||
int64_t lastSpaceNavigatorTime;
|
||||
hGroup lastSpaceNavigatorGroup;
|
||||
void SpaceNavigatorMoved(double tx, double ty, double tz,
|
||||
double rx, double ry, double rz, bool shiftDown);
|
||||
|
|
|
@ -660,13 +660,13 @@ bool FullScreenIsActive(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
int32_t GetMilliseconds(void)
|
||||
int64_t GetMilliseconds(void)
|
||||
{
|
||||
LARGE_INTEGER t, f;
|
||||
QueryPerformanceCounter(&t);
|
||||
QueryPerformanceFrequency(&f);
|
||||
LONGLONG d = t.QuadPart/(f.QuadPart/1000);
|
||||
return (int32_t)d;
|
||||
return (int64_t)d;
|
||||
}
|
||||
|
||||
int64_t GetUnixTime(void)
|
||||
|
|
Loading…
Reference in New Issue