Created
November 3, 2011 18:14
-
-
Save fpersson/1337251 to your computer and use it in GitHub Desktop.
a sleep for unix and windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @brief Alternerar "sov" funktionen beroende på plattform linux/unix sleep() finns i unistd, | |
* medan windows (egentilgen DOS) finns i conio.h inget av detta är C++ eller C ANSI standard. | |
* Funktionen är mest till för att visa hur fjånigt det kan bli i bland. | |
* | |
* @warning samma begränsning här med windows/linux och övriga *nix | |
*/ | |
void doSleep(int timetosleep) | |
{ | |
#ifdef __linux__ | |
timetosleep = timetosleep/1000; | |
//tiden i sekunder | |
sleep(timetosleep); | |
#else | |
//tiden i millisekunder | |
Sleep(timetosleep); | |
#endif | |
} | |
[edit] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment