Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to properly wait for n seconds

Tags:

common-lisp

I want to implement a function which waits n seconds before retrying in case of a failure, but what would be the proper way of implementing the waiting-routine.

I figured that an endless loop with an if-clause might cause unwanted CPU-usage.

(do ((time (+ (get-universal-time) (- n 1)))
     (time-cur (get-universal-time) (get-universal-time)))
    ((< time time-cur) nil))

Therefore: Would this be considered proper code or is there a more standard way?

like image 244
Sim Avatar asked Oct 25 '25 02:10

Sim


1 Answers

Isn't SLEEP what your're looking for?

like image 169
Vsevolod Dyomkin Avatar answered Oct 27 '25 20:10

Vsevolod Dyomkin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!