Re: [patch] gettimeofday.2: mention reasons for failure of settimeofday()

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

 



On 05/12/2018 04:21 PM, Jens Thoms Toerring wrote:
> Hi,
> 
>    as observed recently settimeofday(2) may fail when called
> with reasonably looking values for the time/date if they're
> near to the Epoch. The reason is that it's not possible to
> set the system time to a value that is lower than the number
> of seconds since the system was booted - otherwise the time
> of boot reported by 'uptime -s' would predate the Epoch.
> 
> As this took some time to figure out I think it might be
> worth to mention it in the NOTES section of the man page
> of gettimeofday/settimeofday, see the attached patch.

Hi Jens,

It's pretty clear that there are some missing EINVAL cases
in the manual page. However, I think the case should rather
be documented as 

(tv.tv_set < 0 || tv.tv_usec < 0 || tv.tv_usec >= 1000000)

giving EINVAL. But, perhaps I miss your point. What values
were you specifying to settimeofday() that led to EINVAL?

Cheers,

Michael



-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux