1 // Windows/NationalTime.cpp
2
3 #include "StdAfx.h"
4
5 #include "NationalTime.h"
6
7 namespace NWindows {
8 namespace NNational {
9 namespace NTime {
10
MyGetTimeFormat(LCID locale,DWORD flags,CONST SYSTEMTIME * time,LPCTSTR format,CSysString & resultString)11 bool MyGetTimeFormat(LCID locale, DWORD flags, CONST SYSTEMTIME *time,
12 LPCTSTR format, CSysString &resultString)
13 {
14 resultString.Empty();
15 int numChars = ::GetTimeFormat(locale, flags, time, format, NULL, 0);
16 if (numChars == 0)
17 return false;
18 numChars = ::GetTimeFormat(locale, flags, time, format,
19 resultString.GetBuf((unsigned)numChars), numChars + 1);
20 resultString.ReleaseBuf_CalcLen((unsigned)numChars);
21 return (numChars != 0);
22 }
23
MyGetDateFormat(LCID locale,DWORD flags,CONST SYSTEMTIME * time,LPCTSTR format,CSysString & resultString)24 bool MyGetDateFormat(LCID locale, DWORD flags, CONST SYSTEMTIME *time,
25 LPCTSTR format, CSysString &resultString)
26 {
27 resultString.Empty();
28 int numChars = ::GetDateFormat(locale, flags, time, format, NULL, 0);
29 if (numChars == 0)
30 return false;
31 numChars = ::GetDateFormat(locale, flags, time, format,
32 resultString.GetBuf((unsigned)numChars), numChars + 1);
33 resultString.ReleaseBuf_CalcLen((unsigned)numChars);
34 return (numChars != 0);
35 }
36
37 }}}
38