mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 06:05:58 -06:00
.autotest
This commit is contained in:
parent
344f187626
commit
9222951c5b
5 changed files with 43 additions and 5 deletions
|
|
@ -12,7 +12,7 @@ LOG("==================="); }
|
|||
CONSOLE_APP_MAIN
|
||||
{
|
||||
StdLogSetup(LOG_COUT|LOG_FILE);
|
||||
|
||||
|
||||
DUMP(GetTimeZoneText());
|
||||
|
||||
DUMP(GetTimeZone());
|
||||
|
|
|
|||
6
autotest/TimeFormat/Etalon.log
Normal file
6
autotest/TimeFormat/Etalon.log
Normal 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
|
||||
22
autotest/TimeFormat/TimeFormat.cpp
Normal file
22
autotest/TimeFormat/TimeFormat.cpp
Normal 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();
|
||||
}
|
||||
10
autotest/TimeFormat/TimeFormat.upp
Normal file
10
autotest/TimeFormat/TimeFormat.upp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
Etalon.log,
|
||||
TimeFormat.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue