Make exported date time strings use ISO8601 format

Also rename the function to be explicit on its result format

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15185
This commit is contained in:
Marek Roszko
2023-07-14 23:24:12 -04:00
parent c3222b0652
commit 3233bbe0ba
12 changed files with 16 additions and 17 deletions
+4 -5
View File
@@ -32,6 +32,7 @@
#include <macros.h>
#include <richio.h> // StrPrintf
#include <string_utils.h>
#include <fmt/chrono.h>
/**
@@ -660,12 +661,10 @@ char* GetLine( FILE* File, char* Line, int* LineNum, int SizeLine )
}
wxString DateAndTime()
wxString GetISO8601CurrentDateTime()
{
wxDateTime datetime = wxDateTime::Now();
datetime.SetCountry( wxDateTime::Country_Default );
return datetime.Format( wxDefaultDateTimeFormat, wxDateTime::Local );
std::string str = fmt::format( "{:%FT%T%z}", fmt::localtime( std::time( nullptr ) ) );
return FROM_UTF8( str.c_str() );
}