<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr">вт, 3 апр 2018 г., 14:24 Pavel Tikhomirov <<a href="mailto:ptikhomirov@virtuozzo.com">ptikhomirov@virtuozzo.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
On 04/03/2018 04:11 PM, Dmitry Safonov wrote:<br>
> 2018-04-03 10:34 GMT+01:00 Pavel Tikhomirov <<a href="mailto:ptikhomirov@virtuozzo.com" target="_blank" rel="noreferrer">ptikhomirov@virtuozzo.com</a>>:<br>
> [..]<br>
>> +<br>
>> +#define CSEC_PER_SEC 100<br>
>> +<br>
>> +__maybe_unused int parse_uptime(u_int64_t *upt)<br>
><br>
> Nit: can we use uint64_t?<br>
> I see u_int64_t the first time and git says we've it only in one other place.<br>
<br>
Oops, I brought it from encode_time - will use uint64_t instead, thanks!<br>
<br>
><br>
>> +{<br>
>> + unsigned long sec, csec;<br>
>> + FILE *f;<br>
>> +<br>
>> + f = fopen("/proc/uptime", "r");<br>
>> + if (!f) {<br>
>> + pr_perror("Failed to fopen /proc/uptime");<br>
>> + return -1;<br>
>> + }<br>
>> +<br>
>> + if (fscanf(f, "%lu.%2lu", &sec, &csec) != 2) {<br>
>> + pr_perror("Failed to parse /proc/uptime");<br>
>> + fclose(f);<br>
>> + return -1;<br>
>> + }<br>
>> +<br>
>> + *upt = sec * USEC_PER_SEC + csec * (USEC_PER_SEC / CSEC_PER_SEC);<br>
><br>
> It's not clear from the commit message, why do you save time in usec,<br>
> rather than in csec?<br>
<br>
I thought it would be better to have usec in image, so when/if we have<br>
more precise uptime we can just reuse same variable in image and won't<br>
need adding another one.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">I don't mind. As you'll resend anyway - could you mention</div><div dir="auto">that in commit message, please? ;)</div><div dir="auto"><br></div><div dir="auto"> Thanks,</div><div dir="auto"> Dmitry</div><div dir="auto">(answering from phone, sorry for html)</div></div>