Trond is right! You should use just ImportC ""... EndImport.
usleep(Microseconds.i) is a BSD command (MacOS X is just a modified BSD Unix with a mach kernel, the basic OS parts of MacOS without any GUI are open sourced by Apple and called Darwin) to suspend execution of your program for the specified microseconds. You might as well use sleep(Seconds.i) to wait the specified time in seconds or nanosleep(Nanoseconds.i) to wait the specified nanoseconds. To obtain help for these commands you may open a shell and type
> man usleep
You may even try these commands in the shell:
> sleep 2
This is an example program which I tested on Mavericks (OS X 10.9.5) and which should just work on all MacOS X versions:
Code: Select all
ImportC ""
sleep(Seconds.I) ; Suspend execution for the given number of seconds
usleep(Microseconds.I) ; Suspend execution for the given number of microseconds
nanosleep(Nanoseconds.I) ; Suspend execution for the given number of nanoseconds
EndImport
Debug "Starting to wait for 2 seconds..."
sleep(2)
Debug "2 seconds have expired!"
Debug ""
Debug "Starting to wait for 1500000 microseconds..."
usleep(1500000)
Debug "1500000 microseconds (= 1.5 second) have expired!"
Why do you have to use sleep() at all? I assume that PureBasic's native Delay(Milliseconds.i) command is just a wrapper of usleep() or nanosleep()...
