MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / usleep

Function usleep

src/sleep.c:168–183  ·  view source on GitHub ↗

* \brief microsecond sleep * \param usec is microseconds to sleep * This does not have the same 1000000 limit as POSIX usleep */

Source from the content-addressed store, hash-verified

166 * This does not have the same 1000000 limit as POSIX usleep
167 */
168int usleep(rig_useconds_t usec)
169{
170 int retval;
171 unsigned long sec = usec / 1000000ul;
172 unsigned long nsec = usec * 1000ul - (sec * 1000000000ul);
173 struct timespec t;
174 t.tv_sec = sec;
175 t.tv_nsec = nsec;
176 retval = nanosleep(&t, NULL);
177
178 // EINTR is the only error return usleep should need
179 // since EINVAL should not be a problem
180 if (retval == -1) { return EINTR; }
181
182 return 0;
183}
184#endif
185
186#endif // HAVE_NANOSLEEP

Callers 15

hl_usleepFunction · 0.70
simplecat_transactionFunction · 0.50
simplecat_openFunction · 0.50
dummy_openFunction · 0.50
dummy_closeFunction · 0.50
dummy_set_freqFunction · 0.50
dummy_get_freqFunction · 0.50
dummy_set_modeFunction · 0.50
dummy_get_modeFunction · 0.50
dummy_set_vfoFunction · 0.50
dummy_get_vfoFunction · 0.50
dummy_get_pttFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected