Re: funny gettimeofday



> Always check return codes. gettimeofday() *can* fail (most likely,
> tv1 and/or tv2 are bum pointers that don't point where you think).

As a matter of fact, no, it can not, at least as long as its second argument
is NULL:

# RETURN VALUE
# 
#     The gettimeofday() function shall return 0 and no value shall be
#     reserved to indicate an error.

(Single Unix version 3)

If the provided buffer is invalid, the error will be reported through a
signal (SIGSEGV or maybe SIGBUS if it is an alignment problem).

Attachment: signature.asc
Description: Digital signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]