1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-03 08:51:22 +00:00

TIMER function glitch fixed

This commit is contained in:
Galleon 2013-03-13 00:39:02 +11:00
parent 15deec5d5f
commit 69916a1735

View file

@ -13,6 +13,10 @@
#endif #endif
#endif #endif
int32 fullscreen_smooth=0; int32 fullscreen_smooth=0;
int32 fullscreen_width=0; int32 fullscreen_width=0;
int32 fullscreen_height=0; int32 fullscreen_height=0;
@ -296,11 +300,7 @@ static uint16 codepage437_to_unicode16[] = {
int64 GetTicks(){ int64 GetTicks(){
static int64 x; return ( ( ((int64)clock()) * ((int64)1000) ) / ((int64)CLOCKS_PER_SEC) );
x=clock();
x*=1000;
x/=CLOCKS_PER_SEC;
return x;
} }
@ -311,11 +311,6 @@ return x;
#define QBK 200000 #define QBK 200000
#define VK 100000 #define VK 100000
#define UC 1073741824 #define UC 1073741824
@ -6235,8 +6230,8 @@ extern uint32 cmem_sp; //=65536;
extern ptrszint dblock; //32bit offset of dblock extern ptrszint dblock; //32bit offset of dblock
extern uint64 *nothingvalue; extern uint64 *nothingvalue;
uint32 qb64_firsttimervalue; uint32 qb64_firsttimervalue;//based on time of day
uint32 sdl_firsttimervalue; uint32 clock_firsttimervalue;//based on program launch time
extern uint32 qbevent; extern uint32 qbevent;
@ -13489,7 +13484,7 @@ static uint32 x;
static double d; static double d;
static float f; static float f;
x=GetTicks(); x=GetTicks();
x-=sdl_firsttimervalue; x-=clock_firsttimervalue;
x+=qb64_firsttimervalue; x+=qb64_firsttimervalue;
//make timer value loop after midnight //make timer value loop after midnight
//note: there are 86400000 milliseconds in 24hrs(1 day) //note: there are 86400000 milliseconds in 24hrs(1 day)
@ -28624,6 +28619,7 @@ int main( int argc, char* argv[] )
{ {
set_dynamic_info(); set_dynamic_info();
if (ScreenResize){ if (ScreenResize){
resize_snapback=0; resize_snapback=0;
@ -29044,7 +29040,7 @@ if (qb64_tm_val_old!=-1){
}else{ }else{
qb64_tm_val=0;//time unknown! (set to midnight, January 1, 1970) qb64_tm_val=0;//time unknown! (set to midnight, January 1, 1970)
} }
sdl_firsttimervalue=GetTicks(); clock_firsttimervalue=GetTicks();
//calculate localtime as milliseconds past midnight //calculate localtime as milliseconds past midnight
qb64_tm=localtime(&qb64_tm_val); qb64_tm=localtime(&qb64_tm_val);
/* re: localtime() /* re: localtime()
@ -29061,7 +29057,7 @@ if (qb64_tm){
} }
/* Used as follows for calculating TIMER value: /* Used as follows for calculating TIMER value:
x=GetTicks(); x=GetTicks();
x-=sdl_firsttimervalue; x-=clock_firsttimervalue;
x+=qb64_firsttimervalue; x+=qb64_firsttimervalue;
*/ */
@ -29356,7 +29352,7 @@ static uint32 cmem_ticks;
static double cmem_ticks_double; static double cmem_ticks_double;
cmem_ticks=GetTicks(); cmem_ticks=GetTicks();
cmem_ticks-=sdl_firsttimervalue; cmem_ticks-=clock_firsttimervalue;
cmem_ticks+=qb64_firsttimervalue; cmem_ticks+=qb64_firsttimervalue;
//make timer value loop after midnight //make timer value loop after midnight
//note: there are 86400000 milliseconds in 24hrs(1 day) //note: there are 86400000 milliseconds in 24hrs(1 day)