Pi-WiringPi-Reference-TimeManagament
Gestion du temps
While Linux provides a multitude of system calls and functions to providing various timing and sleeping functions, sometimes it can be quite confusing, especially if you are new to Linux, so the ones presented here mimic those available on the Arduino platform, making porting code and writing new code somewhat easier.
Note: Even if you are not using any of the input/output functions you still need to call one of the wiringPi setup functions – just use wiringPiSetupSys() if you don’t need root access in your program and remember to #include <wiringPi.h>
Fonctions
millis
unsigned int millis(void)
This returns a number representing the number if milliseconds since your program called one of the wiringPiSetup functions. It returns an unsigned 32-bit number which wraps after 49 days.
micros
unsigned int micros(void)
This returns a number representing the number of microseconds since your program called one of the wiringPiSetup functions. It returns an unsigned 32-bit number which wraps after approximately 71 minutes.
delay
void delay (unsigned int howLong)
This causes program execution to pause for at least howLong milliseconds. Due to the multi-tasking nature of Linux it could be longer. Note that the maximum delay is an unsigned 32-bit integer or approximately 49 days.
delayMicroseconds
void delayMicroseconds (unsigned int howLong)
This causes program execution to pause for at least howLong microseconds. Due to the multi-tasking nature of Linux it could be longer. Note that the maximum delay is an unsigned 32-bit integer microseconds or approximately 71 minutes.
Delays under 100 microseconds are timed using a hard-coded loop continually polling the system time, Delays over 100 microseconds are done using the system nanosleep() function – You may need to consider the implications of very short delays on the overall performance of the system, especially if using threads.
Source: WiringPi.com. WiringPi est une libraire sous licence GPL écrite par Gordon Henderson. Crédit: wiringpi.com
Traduit de l'anglais par Meurisse D. pour MCHobby.be
Traduit avec l'accord de Gordon Henderson, créateur de wiringPi - Translated with authorization of Gordon Henderson, creator of wiringPi
Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : « Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.
L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.