Skip to content

Commit 4ec2364

Browse files
Xunlei Pangjohnstultz-work
authored andcommitted
rtc: Update rtc-dev to use y2038-safe time interfaces
Currently, rtc-dev.c uses y2038 problematic rtc_tm_to_time() and rtc_time_to_tm(). So replace them with their corresponding y2038-safe versions: rtc_tm_to_time64() and rtc_time64_to_tm(). Cc: pang.xunlei <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Signed-off-by: Xunlei Pang <[email protected]> Signed-off-by: John Stultz <[email protected]>
1 parent bc10aa9 commit 4ec2364

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/rtc/rtc-dev.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,24 +304,24 @@ static long rtc_dev_ioctl(struct file *file,
304304
* Not supported here.
305305
*/
306306
{
307-
unsigned long now, then;
307+
time64_t now, then;
308308

309309
err = rtc_read_time(rtc, &tm);
310310
if (err < 0)
311311
return err;
312-
rtc_tm_to_time(&tm, &now);
312+
now = rtc_tm_to_time64(&tm);
313313

314314
alarm.time.tm_mday = tm.tm_mday;
315315
alarm.time.tm_mon = tm.tm_mon;
316316
alarm.time.tm_year = tm.tm_year;
317317
err = rtc_valid_tm(&alarm.time);
318318
if (err < 0)
319319
return err;
320-
rtc_tm_to_time(&alarm.time, &then);
320+
then = rtc_tm_to_time64(&alarm.time);
321321

322322
/* alarm may need to wrap into tomorrow */
323323
if (then < now) {
324-
rtc_time_to_tm(now + 24 * 60 * 60, &tm);
324+
rtc_time64_to_tm(now + 24 * 60 * 60, &tm);
325325
alarm.time.tm_mday = tm.tm_mday;
326326
alarm.time.tm_mon = tm.tm_mon;
327327
alarm.time.tm_year = tm.tm_year;

0 commit comments

Comments
 (0)