Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

According to the API, clock_gettime() can only error out for two reasons: EFAULT when the 2nd argument points to invalid memory or EINVAL when the clock is not supported on the system.

The first thing is ensured in the code, the 2nd thing can be ensured by, for example, checking for the existence of CLOCK_MONOTONIC in an initialization function, which we don't see in this example.

So I'd say that this is a case where you can relinquish checking the return value without feeling bad about it.

Same thing about sleep/usleep: All possible situations (sleeping correctly, and being interrupted) are handled correctly by the code (if you don't intend to handle signals, of course...).



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: