![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Mar 2006
Location: Lebanon
Posts: 148
Rep Power: 3
![]() |
Delay using ctime
this is a delay function i wrote:
bool Delay(int delaytime) {
int time1 = time(0);
int time2 = time(0);
while(time2-time1 < delaytime )
{time2 = time(0); }
return true ;
}this creates a delay of an integer amount in seconds. is it possible to create a delay in 100ms or 1.5 seconds? time(0) never returns a decimal number, only whole numbers |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Good search doggy.
Edit: Note that it has been mentioned many times that it will not be exact as Windows or Unix (or mainstream OS) is not realtime. If you want to know more, use the searchterm "real time". Like here.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|