Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Timer

Name: Anonymous 2008-02-16 7:34

Hi /prog/,

I know intermediate level Visual Basic (yes i know it's AIDS) and am learning C. I'm just wondering if there's a way to implement timer like functionality in C and if there is how to go about it.

Name: Anonymous 2008-02-16 8:56

>>4
On Windows:
#include <windows.h>

On UNIX/BSD/etc.:
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>

And finally:
timeval waittime;
waittime.tv_sec = SecondstoWait;
waittime.tv_usec = MicroSecondsToWait;
select( 0, NULL, NULL, NULL, &waittime );

But in most cases the system-timer has got only Millisecond-resolution.
I'm pretty sure the last sentence is wrong. Sorry for that.
Btw.: select( ) is a socket-function.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List