/* This file is part of Lcrzo.
*/

int lcrzo_time_sleep_usec(lcrzo_uint32 usec)
#if defined LCRZODEF_SYSTEM_Unix
{ lcrzo_uint32 time_sleep_threshold3;

  lcrzo_er(lcrzo_global_get_time_sleep_3threshold(&time_sleep_threshold3));

  if (usec<time_sleep_threshold3)
  { /*utilise usleep*/
    usleep(usec);
  }
  else
  { /*utilise sleep*/
    sleep(usec/1000000);
  }

  errno=0; /*because Solaris sets errno to 4*/
  return(LCRZO_ERR_OK);
}
#elif defined LCRZODEF_SYSTEM_Windows
{ if (usec<1000) 
  { Sleep(1);
  }
  else
  { Sleep(usec/1000);
  }
  return(LCRZO_ERR_OK);
}
#else
 #error "Unknown value for LCRZODEF_SYSTEM"
#endif

