* [PATCH] timer: avoid using timespec
@ 2016-06-17 15:30 Arnd Bergmann
2016-06-17 20:50 ` John Stultz
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2016-06-17 15:30 UTC (permalink / raw)
To: Thomas Gleixner, John Stultz; +Cc: y2038, Arnd Bergmann, linux-kernel
The tstats_show() function prints a ktime_t variable by converting
it to struct timespec first. The algorithm is ok, but we want to
stop using timespec in general because of the 32-bit time_t
overflow problem.
This changes the code to use struct timespec64, without any
functional change.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
kernel/time/timer_stats.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/time/timer_stats.c b/kernel/time/timer_stats.c
index 1adecb4b87c8..087204c733eb 100644
--- a/kernel/time/timer_stats.c
+++ b/kernel/time/timer_stats.c
@@ -279,7 +279,7 @@ static void print_name_offset(struct seq_file *m, unsigned long addr)
static int tstats_show(struct seq_file *m, void *v)
{
- struct timespec period;
+ struct timespec64 period;
struct entry *entry;
unsigned long ms;
long events = 0;
@@ -295,11 +295,11 @@ static int tstats_show(struct seq_file *m, void *v)
time = ktime_sub(time_stop, time_start);
- period = ktime_to_timespec(time);
+ period = ktime_to_timespec64(time);
ms = period.tv_nsec / 1000000;
seq_puts(m, "Timer Stats Version: v0.3\n");
- seq_printf(m, "Sample period: %ld.%03ld s\n", period.tv_sec, ms);
+ seq_printf(m, "Sample period: %ld.%03ld s\n", (long)period.tv_sec, ms);
if (atomic_read(&overflow_count))
seq_printf(m, "Overflow: %d entries\n", atomic_read(&overflow_count));
seq_printf(m, "Collection: %s\n", timer_stats_active ? "active" : "inactive");
--
2.9.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] timer: avoid using timespec
2016-06-17 15:30 [PATCH] timer: avoid using timespec Arnd Bergmann
@ 2016-06-17 20:50 ` John Stultz
0 siblings, 0 replies; 2+ messages in thread
From: John Stultz @ 2016-06-17 20:50 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: Thomas Gleixner, y2038 Mailman List, lkml
On Fri, Jun 17, 2016 at 8:30 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> The tstats_show() function prints a ktime_t variable by converting
> it to struct timespec first. The algorithm is ok, but we want to
> stop using timespec in general because of the 32-bit time_t
> overflow problem.
>
> This changes the code to use struct timespec64, without any
> functional change.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Queued for testing.
thanks
-john
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-17 20:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-17 15:30 [PATCH] timer: avoid using timespec Arnd Bergmann
2016-06-17 20:50 ` John Stultz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®