From 906229814e7538a812ed0fbb0c3ee28be65dff20 Mon Sep 17 00:00:00 2001 From: Pawel Jalocha Date: Sat, 26 Sep 2020 02:42:15 +0100 Subject: [PATCH] Add setting the time/date for the IGC files --- main/sdlog.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main/sdlog.cpp b/main/sdlog.cpp index 436464e..7258e3f 100644 --- a/main/sdlog.cpp +++ b/main/sdlog.cpp @@ -93,7 +93,15 @@ static void IGC_Close(void) Format_String(CONS_UART_Write, IGC_FileName); Format_String(CONS_UART_Write, "\n"); xSemaphoreGive(CONS_Mutex); - fclose(IGC_File); IGC_File=0; IGC_FlightNum++; } + fclose(IGC_File); IGC_File=0; IGC_FlightNum++; + uint32_t Time = TimeSync_Time(); + struct stat FileStat; + struct utimbuf FileTime; + if(stat(IGC_FileName, &FileStat)>=0) // get file attributes (maybe not needed really ? + { FileTime.actime = Time; // set access and modification tim$ + FileTime.modtime = Time; + utime(IGC_FileName, &FileTime); } // write to the FAT + } } static int IGC_Open(void)