Procházet zdrojové kódy

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 <who.just.the.doctor@gmail.com>
Lesha Lomalkin před 4 roky
rodič
revize
8851a240ab
1 změnil soubory, kde provedl 6 přidání a 1 odebrání
  1. 6 1
      applications/cli/cli_commands.c

+ 6 - 1
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);