Thread (13 messages) flat view 13 messages, 3 authors, 2018-03-08

Re: [PATCH v3 3/4] rtc: isl1208: add support for isl1219 with tamper detection

From: Alexandre Belloni <hidden>
Date: 2018-03-08 12:05:53
Also in: linux-rtc, lkml

On 08/03/2018 at 11:53:09 +0000, Denis OSTERLAND wrote:
Am Mittwoch, den 07.03.2018, 11:47 +0100 schrieb Alexandre Belloni:
quoted
quoted
quoted
quoted
+
+	tv64.tv_sec = rtc_tm_to_time64(&tm);
Why not using an unsigned long long directly here? time64_t is not the
correct type.
Do you mean timespec64 is not the correct type here?
Then yes, sould be time64_t.
If you mean time64_t is not the correct type here,
then can you give me some detail why there is no rtc_tm_to_u64,
or something like that?
The rtc subsystem forbids negative times, the proper type should be
unsigned.
I will add rtc_vaild_tm check.

Which sequence for time conversion would you expect?

time64_t secs = rtc_tm_to_time64(&tm);
BUG_ON(secs < 0);
return sprintf(buf, "%llu\n", (unsigned long long)secs);

or

return sprintf(buf, "%llu\n", (unsigned long long)rtc_tm_to_time64(&tm));
rtc_vaild_tm will already return EINVAL in case of negative time so this
is the one you should use.

-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help