mirror of
https://github.com/fltk/fltk.git
synced 2026-05-28 20:06:18 +08:00
Fixed bug in WIN32 fl_elapsed() function - didn't initialize
prevclock to valid value [now use GetClockTicks()], and didn't check for newclock < prevclock (which would be the case if no messages have been processed yet). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@580 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+5
-3
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: Fl.cxx,v 1.24.2.6 1999/05/06 06:20:46 bill Exp $"
|
// "$Id: Fl.cxx,v 1.24.2.7 1999/05/07 16:17:49 mike Exp $"
|
||||||
//
|
//
|
||||||
// Main event handling code for the Fast Light Tool Kit (FLTK).
|
// Main event handling code for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@@ -164,7 +164,9 @@ static double fl_elapsed() {
|
|||||||
unsigned long newclock = fl_msg.time; // NOT YET IMPLEMENTED!
|
unsigned long newclock = fl_msg.time; // NOT YET IMPLEMENTED!
|
||||||
const int TICKS_PER_SECOND = 1000; // divisor of the value to get seconds
|
const int TICKS_PER_SECOND = 1000; // divisor of the value to get seconds
|
||||||
static unsigned long prevclock;
|
static unsigned long prevclock;
|
||||||
if (!initclock) {prevclock = newclock; initclock = 1; return 0.0;}
|
if (!initclock) {prevclock = newclock = GetTickCount(); initclock = 1; return 0.0;}
|
||||||
|
else if (newclock < prevclock) return 0.0;
|
||||||
|
|
||||||
double t = double(newclock-prevclock)/TICKS_PER_SECOND;
|
double t = double(newclock-prevclock)/TICKS_PER_SECOND;
|
||||||
prevclock = newclock;
|
prevclock = newclock;
|
||||||
|
|
||||||
@@ -696,5 +698,5 @@ int fl_old_shortcut(const char* s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fl.cxx,v 1.24.2.6 1999/05/06 06:20:46 bill Exp $".
|
// End of "$Id: Fl.cxx,v 1.24.2.7 1999/05/07 16:17:49 mike Exp $".
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user