On 05/13/2018 03:23 PM, Jens Thoms Toerring wrote: > Hi Michael, > > thank you foer the fast reply! > > On Sun, May 13, 2018 at 01:14:19PM +0200, Michael Kerrisk (man-pages) wrote: >> 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? > > I agree that the obvious case does not need to be docu- > mented. But the problem was that we were (accidentally) > trying to set the system time to e.g. 37 seconds after > the epoch (i.e. tv.tv_sec = 37 and tv.tv_nsec = 0) when > the system already had been up for several minutes. We > were puzzled to get a failure from settimeofday() before > realizing that you obviously can't set the system ime to > anything nearer to the epoch than the current value of > the uptime. Which makes a certain amount of sense as > otherwise 'uptime -s' would have to report a time be- > fore the start of the epoch. > > But, obviously, my attempt at describing the case in > the patch wasn't very clear, so I probably better give > it another try;-) > > I guess (but haven't tried yet) that the same will be > the case for clock_settime(). Okay -- we just crossed mails ;-). See my patch in the other mail, which also covers clock_settime(CLOCK_REALTIME) 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