From 8851a240abaad1c76e7f984306b7164400c632d6 Mon Sep 17 00:00:00 2001 From: Lesha Lomalkin Date: Wed, 2 Jun 2021 15:56:28 +0300 Subject: [PATCH] fixed line end in cli:hw_info command (#503) * fixed line end in cli:hw_info command * remove x0a from ctime() out * syntax fix * use reentrant verison of ctime Co-authored-by: DrZlo13 --- applications/cli/cli_commands.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/applications/cli/cli_commands.c b/applications/cli/cli_commands.c index aed63513..20b10263 100644 --- a/applications/cli/cli_commands.c +++ b/applications/cli/cli_commands.c @@ -101,7 +101,12 @@ void cli_command_hw_info(Cli* cli, string_t args, void* context) { api_hal_version_get_hw_body(), api_hal_version_get_hw_connect()); time_t time = api_hal_version_get_hw_timestamp(); - printf("%-20s %s\r", "Production date:", ctime(&time)); + char time_string[26] = ""; + ctime_r(&time, time_string); + if(time_string[strlen(time_string) - 1] == '\n') { + time_string[strlen(time_string) - 1] = '\0'; + } + printf("%-20s %s\r\n", "Production date:", time_string); const char* name = api_hal_version_get_name_ptr(); if(name) { printf("%-20s %s", "Name:", name);