.autotest

This commit is contained in:
Mirek Fidler 2024-04-13 14:18:01 +02:00
parent 344f187626
commit 9222951c5b
5 changed files with 43 additions and 5 deletions

View file

@ -12,7 +12,7 @@ LOG("==================="); }
CONSOLE_APP_MAIN
{
StdLogSetup(LOG_COUT|LOG_FILE);
DUMP(GetTimeZoneText());
DUMP(GetTimeZone());

View file

@ -0,0 +1,6 @@
* C:\upp\out\autotest\CLANGx64.Debug.Debug_Full\TimeFormat.exe 13.04.2024 14:17:41, user: cxl
d = April 13, 2024
ScanDate(AsString(d)) = April 13, 2024
d = APR 13, 2024
ScanDate(AsString(d)) = APR 13, 2024

View file

@ -0,0 +1,22 @@
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
StdLogSetup(LOG_COUT|LOG_FILE);
for(const char *s : { "%2:Month %3:d, %1:d;mdy", "%2:MON %3:d, %1:d;mdy" }) {
String fmt, scan;
SplitTo(s, ";", fmt, scan);
SetDateFormat(fmt);
SetDateScan(scan);
Date d = Date(2024, 4, 13);
DDUMP(d);
DDUMP(ScanDate(AsString(d)));
}
CheckLogEtalon();
}

View file

@ -0,0 +1,10 @@
uses
Core;
file
Etalon.log,
TimeFormat.cpp;
mainconfig
"" = "";

View file

@ -68,14 +68,14 @@ String MonName(int i, int lang)
return i >= 0 && i < 12 ? Nvl(GetLngString(lang, month[i]), GetENUS(month[i])) : String();
}
static thread_local char s_date_format_thread[64];
static char s_date_format_main[64] = "%2:02d/%3:02d/%1:4d";
static thread_local char s_date_format_thread[128];
static char s_date_format_main[128] = "%2:02d/%3:02d/%1:4d";
void SetDateFormat(const char *fmt)
{
strncpy(s_date_format_thread, fmt, 63);
strncpy(s_date_format_thread, fmt, 127);
if(Thread::IsMain())
strncpy(s_date_format_main, fmt, 63);
strncpy(s_date_format_main, fmt, 127);
}
#ifdef PLATFORM_WIN32 // resolve nameclash with win32 API