[q-lang-cvs] q/src qmfuns.c,1.82,1.83 sys.c,1.2,1.3
Brought to you by:
agraef
From: Albert G. <ag...@us...> - 2008-02-22 11:56:09
|
Update of /cvsroot/q-lang/q/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27732/src Modified Files: qmfuns.c sys.c Log Message: systime() and syssleep() use time values in seconds rather than millisecs Index: sys.c =================================================================== RCS file: /cvsroot/q-lang/q/src/sys.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sys.c 24 Sep 2007 12:21:03 -0000 1.2 --- sys.c 22 Feb 2008 11:55:51 -0000 1.3 *************** *** 174,178 **** struct timeb tb; ftime(&tb); ! return ((double)tb.time)*1e3+((double)tb.millitm); } --- 174,178 ---- struct timeb tb; ftime(&tb); ! return ((double)tb.time)+((double)tb.millitm)*1e-3; } *************** *** 181,185 **** double systime(void) { ! return (double)time(NULL)*1e3; } --- 181,185 ---- double systime(void) { ! return (double)time(NULL); } *************** *** 196,200 **** unsigned long nsecs; struct timespec req; ! fp = modf(t/1e3, &ip); if (ip > LONG_MAX) { ip = (double)LONG_MAX; fp = 0.0; } secs = (unsigned long)ip; --- 196,200 ---- unsigned long nsecs; struct timespec req; ! fp = modf(t, &ip); if (ip > LONG_MAX) { ip = (double)LONG_MAX; fp = 0.0; } secs = (unsigned long)ip; *************** *** 205,215 **** #ifdef HAVE_USLEEP unsigned long usecs; ! if (t*1e3 > LONG_MAX) t = LONG_MAX/1e3; ! fp = modf(t/1e3, &ip); secs = (unsigned long)ip; usecs = (unsigned long)(fp*1e6); usleep(secs*1000000U+usecs); #else ! fp = modf(t/1e3, &ip); if (ip > LONG_MAX) ip = (double)LONG_MAX; secs = (unsigned long)ip; --- 205,215 ---- #ifdef HAVE_USLEEP unsigned long usecs; ! if (t > LONG_MAX) t = LONG_MAX; ! fp = modf(t, &ip); secs = (unsigned long)ip; usecs = (unsigned long)(fp*1e6); usleep(secs*1000000U+usecs); #else ! fp = modf(t, &ip); if (ip > LONG_MAX) ip = (double)LONG_MAX; secs = (unsigned long)ip; *************** *** 231,235 **** double ip, fp; if (t > LONG_MAX) t = LONG_MAX; ! fp = modf(t/1e3, &ip); secs = (unsigned long)ip; msecs = (unsigned short)(fp*1e3); --- 231,235 ---- double ip, fp; if (t > LONG_MAX) t = LONG_MAX; ! fp = modf(t, &ip); secs = (unsigned long)ip; msecs = (unsigned short)(fp*1e3); Index: qmfuns.c =================================================================== RCS file: /cvsroot/q-lang/q/src/qmfuns.c,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** qmfuns.c 1 Dec 2007 12:29:57 -0000 1.82 --- qmfuns.c 22 Feb 2008 11:55:51 -0000 1.83 *************** *** 5097,5101 **** static qmtime(THREAD* thr) { ! return pushfloat(thr, systime()/1e3); } --- 5097,5101 ---- static qmtime(THREAD* thr) { ! return pushfloat(thr, systime()); } *************** *** 5109,5113 **** release_lock(); #endif ! syssleep(d*1e3); #ifdef USE_THREADS acquire_lock(); --- 5109,5113 ---- release_lock(); #endif ! syssleep(d); #ifdef USE_THREADS acquire_lock(); *************** *** 5119,5123 **** release_lock(); #endif ! syssleep(args[0]->data.f*1e3); #ifdef USE_THREADS acquire_lock(); --- 5119,5123 ---- release_lock(); #endif ! syssleep(args[0]->data.f); #ifdef USE_THREADS acquire_lock(); |