TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: JERRY COFFIN
from: NEIL HELLER
date: 1997-05-16 20:42:00
subject: TIMER() AND DIFFTIME()

NH> do {
NH>    end = time(NULL);
NH> } while (difftime(end, start) < 60.0);
JC> I'd _strongly_ advise doing this considerably differently.  I'd
JC> use something more like:
JC> 
JC> void CALLBACK TimerProc(HWND wnd, UINT, UINT timer, DWORD) {
JC>     KillTimer(wnd, timer);  // The timer will continue to fire
JC>                             // every minute unless we kill it.
I currently use my method in a much larger loop inside a comm. program
while I'm waiting for modems to hash.  There is quite a bit of
processing going in the loop besides just time polling.  Nevertheless,
it seems to me that a Windows timer would probably be preferable as it
would most likely free more other processes.
One question though.  How does the timer itself get the time?
 * KWQ/2 1.2i * 
--- TMail v1.31.5
---------------
* Origin: Diablo Valley PCUG-BBS, Walnut Creek, CA 510/943-6238 (1:161/55)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.