Vasek,<br><br>first, please refer to my previous answer, a few hours ago (including links).<br>I've not bothered summing up myself, since the link does pretty well.<br>you'll find there most if not all answers to your questions.<br>
<br><div class="gmail_quote">2012/10/9  <span dir="ltr"><<a href="mailto:VaclavKrpec@eaton.com" target="_blank">VaclavKrpec@eaton.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Charles,<br>
<div class="im"><br>
> I don't think we should ignore an EINVAL error, and we should fall back to<br>
> gettimeofday() in that case. (I know gettimeofday is deprecated, but if<br>
> CLOCK_MONOTONIC isn't quite right, then gettimeofday should work.)<br>
<br>
</div>Aw, I think I might have been Â too fast with condemning gettimeofday, before.<br>
I've actually found one point at the code where we might need it<br>
if POSIX clock isn't available:<br></blockquote><div><br>I've (still) not looked thoroughly enough, but I dont' see a problem here.<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

in drivers/bcmxcp_usb.c::get_answer function, usb_interrupt_read<br></blockquote><div><br>FYI, I've planned a rewrite of this driver, and IIRC still have a patch to apply that rewrite get_answer (still using gettimeofday() though).<br>
the time here is just to allow receiving all data chunks  within XCP_USB_TIMEOUT (5 seconds).<br>usb_interrupt_read() last param (timeout) is indeed milliseconds.<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

function's last argument appears to be required with ms precision.<br>
If we don't have POSIX clock in this case, the time_t fallback will<br>
decrease the timeout precision. Â It is questionable, however, whether<br>
this is indeed so important (other drivers typically use hard 1s timeout<br>
on usb_interrupt_read).<br>
This should be discussed, I think.<br></blockquote><div><br>other driver generally knows how much they have to receive, and 1 request is generally sufficient.<br>XCP tells you if the current block is last, or if you have to issue further requests.<br>
thus, the timeout is global to all these requests, and decreasing each time there is a new request.<br><br>on the timeout precision, XCP uses 5 (seconds), but having everything done between 4 to 6 seconds is good enough to me.<br>
<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The other usages may be easily replaced by both POSIX clock or time_t, IMO.<br clear="all"></blockquote></div><br>cheers,<br>Arnaud<br>-- <br>Network UPS Tools (NUT) Project Leader - <a href="http://www.networkupstools.org" target="_blank">http://www.networkupstools.org</a><br>
Debian Developer - <a href="http://www.debian.org" target="_blank">http://www.debian.org</a><br>Free Software Developer - <a href="http://arnaud.quette.fr" target="_blank">http://arnaud.quette.fr</a><br><br>