Welcome to mirror list, hosted at ThFree Co, Russian Federation.

NationalTime.cpp « Windows « CPP - github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7606021668038c32191bae02e20875c7ebd79a6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Windows/NationalTime.cpp

#include "StdAfx.h"

#include "Windows/NationalTime.h"

namespace NWindows {
namespace NNational {
namespace NTime {

bool MyGetTimeFormat(LCID locale, DWORD flags, CONST SYSTEMTIME *time, 
    LPCTSTR format, CSysString &resultString)
{
  resultString.Empty();
  int numChars = ::GetTimeFormat(locale, flags, time, format, NULL, 0);
  if(numChars == 0)
    return false;
  numChars = ::GetTimeFormat(locale, flags, time, format,
      resultString.GetBuffer(numChars), numChars + 1);
  resultString.ReleaseBuffer();
  return (numChars != 0);
}

bool MyGetDateFormat(LCID locale, DWORD flags, CONST SYSTEMTIME *time, 
    LPCTSTR format, CSysString &resultString)
{
  resultString.Empty();
  int numChars = ::GetDateFormat(locale, flags, time, format, NULL, 0);
  if(numChars == 0)
    return false;
  numChars = ::GetDateFormat(locale, flags, time, format,
      resultString.GetBuffer(numChars), numChars + 1);
  resultString.ReleaseBuffer();
  return (numChars != 0);
}

}}}