Skip to content

Commit f35491b

Browse files
Daniel Bristot de Oliveirarostedt
authored andcommitted
rtla/utils: Fix session duration parsing
Use gmtime to format the duration time. This avoids problems when the system uses local time different of Pisa's Local Time. Link: https://lkml.kernel.org/r/a2f0a37bc006c2561bb8ecd871cd70532b4a9f2d.1643990447.git.bristot@kernel.org Fixes: b169637 ("rtla: Helper functions for rtla") Cc: Daniel Bristot de Oliveira <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Daniel Bristot de Oliveira <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 8619e32 commit f35491b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/tracing/rtla/src/utils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ void get_duration(time_t start_time, char *output, int output_size)
7777
time_t duration;
7878

7979
duration = difftime(now, start_time);
80-
tm_info = localtime(&duration);
80+
tm_info = gmtime(&duration);
8181

8282
snprintf(output, output_size, "%3d %02d:%02d:%02d",
8383
tm_info->tm_yday,
84-
tm_info->tm_hour - 1,
84+
tm_info->tm_hour,
8585
tm_info->tm_min,
8686
tm_info->tm_sec);
8787
}

0 commit comments

Comments
 (0)