linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] frv: Use read_persistent_clock64() instead of read_persistent_clock()
@ 2018-02-28  6:12 Baolin Wang
  0 siblings, 0 replies; only message in thread
From: Baolin Wang @ 2018-02-28  6:12 UTC (permalink / raw)
  To: john.stultz, arnd; +Cc: linux-kernel, broonie, baolin.wang

The struct timespec is not y2038 safe on 32bit systems, thus this patch
converts the read_persistent_clock() to read_persistent_clock64() with
using struct timespec64. We also use time64_t type to record system time
by converting the mktime() to mktime64() .

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
 arch/frv/kernel/time.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c
index 332e00b..5f5e90e 100644
--- a/arch/frv/kernel/time.c
+++ b/arch/frv/kernel/time.c
@@ -85,7 +85,7 @@ void time_divisor_init(void)
 }
 
 
-void read_persistent_clock(struct timespec *ts)
+void read_persistent_clock64(struct timespec64 *ts)
 {
 	unsigned int year, mon, day, hour, min, sec;
 
@@ -101,7 +101,7 @@ void read_persistent_clock(struct timespec *ts)
 
 	if ((year += 1900) < 1970)
 		year += 100;
-	ts->tv_sec = mktime(year, mon, day, hour, min, sec);
+	ts->tv_sec = mktime64(year, mon, day, hour, min, sec);
 	ts->tv_nsec = 0;
 }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-02-28  6:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-28  6:12 [PATCH] frv: Use read_persistent_clock64() instead of read_persistent_clock() Baolin Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).