def nanosleepMicroseconds(us):
  """ Delay microseconds with libc nanosleep() using ctypes. """
  if (us >= 1000000): 
    sec = us/1000000
    us %= 1000000
  else: sec = 0
  nanosleep_req.tv_sec = sec
  nanosleep_req.tv_nsec = int(us * 1000)

  libc.nanosleep(nanosleep_req, nanosleep_rem)

#------------------------------------

#--- Millisecond delay functions: ---
dataset/ETHPy150Open graycatlabs/PyBBIO/tests/sleep_test.py/nanosleepMicroseconds/original