aboutsummaryrefslogtreecommitdiff
path: root/CPP/Windows/NationalTime.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/Windows/NationalTime.cpp')
-rw-r--r--CPP/Windows/NationalTime.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/CPP/Windows/NationalTime.cpp b/CPP/Windows/NationalTime.cpp
new file mode 100644
index 0000000..0dcd31e
--- /dev/null
+++ b/CPP/Windows/NationalTime.cpp
@@ -0,0 +1,37 @@
1// Windows/NationalTime.cpp
2
3#include "StdAfx.h"
4
5#include "NationalTime.h"
6
7namespace NWindows {
8namespace NNational {
9namespace NTime {
10
11bool 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(numChars), numChars + 1);
20 resultString.ReleaseBuf_CalcLen(numChars);
21 return (numChars != 0);
22}
23
24bool 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(numChars), numChars + 1);
33 resultString.ReleaseBuf_CalcLen(numChars);
34 return (numChars != 0);
35}
36
37}}}