ReactOS  0.4.14-dev-608-gd495a4f
locale.c
Go to the documentation of this file.
1 /*
2  * LOCALE.C - locale handling.
3  *
4  *
5  * History:
6  *
7  * 09-Jan-1999 (Eric Kohl)
8  * Started.
9  *
10  * 20-Jan-1999 (Eric Kohl)
11  * Unicode safe!
12  */
13 
14 #include "precomp.h"
15 
23 
24 
26 {
27  TCHAR szBuffer[256];
28 
29  /* date settings */
31  cDateSeparator = szBuffer[0];
32  GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IDATE | LOCALE_RETURN_NUMBER, (LPTSTR)&nDateFormat, sizeof(nDateFormat) / sizeof(TCHAR));
33 
34  /* time settings */
36  cTimeSeparator = szBuffer[0];
37  GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ITIME | LOCALE_RETURN_NUMBER, (LPTSTR)&nTimeFormat, sizeof(nTimeFormat) / sizeof(TCHAR));
38 
39  /* number settings */
41  cThousandSeparator = szBuffer[0];
43  cDecimalSeparator = szBuffer[0];
45  nNumberGroups = _ttoi(szBuffer);
46 #if 0
47  /* days of week */
48  for (i = 0; i < 7; i++)
49  {
51  _tcscpy(aszDayNames[(i+1)%7], szBuffer); /* little hack */
52  }
53 #endif
54 }
55 
56 /* Return date string including weekday. Used for $D in prompt and %DATE% */
57 LPTSTR
59 {
60  static TCHAR szDate[32];
61  SYSTEMTIME t;
62  INT len;
63  GetLocalTime(&t);
64 
66  szDate[len - 1] = _T(' ');
67  FormatDate(&szDate[len], &t, TRUE);
68  return szDate;
69 }
70 
71 /* Return time in hh:mm:ss.xx format. Used for $T in prompt and %TIME% */
72 LPTSTR
74 {
75  static TCHAR szTime[12];
76  SYSTEMTIME t;
77  GetLocalTime(&t);
78  _stprintf(szTime, _T("%2d%c%02d%c%02d%c%02d"),
79  t.wHour, cTimeSeparator, t.wMinute, cTimeSeparator,
80  t.wSecond, cDecimalSeparator, t.wMilliseconds / 10);
81  return szTime;
82 }
#define LOCALE_SGROUPING
Definition: winnls.h:44
TCHAR cDateSeparator
Definition: locale.c:16
#define TRUE
Definition: types.h:120
TCHAR szTime[64]
Definition: solitaire.cpp:18
VOID InitLocale(VOID)
Definition: locale.c:25
#define LOCALE_SABBREVDAYNAME1
Definition: winnls.h:84
#define LOCALE_IDATE
Definition: winnls.h:63
#define LOCALE_USER_DEFAULT
INT nNumberGroups
Definition: locale.c:22
#define GetLocaleInfo
Definition: winnls.h:1183
LPTSTR GetTimeString(VOID)
Definition: locale.c:73
GLdouble GLdouble t
Definition: gl.h:2047
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
INT FormatDate(TCHAR *, LPSYSTEMTIME, BOOL)
Definition: dir.c:674
int32_t INT
Definition: typedefs.h:56
LPTSTR GetDateString(VOID)
Definition: locale.c:58
CHAR * LPTSTR
Definition: xmlstorage.h:192
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define LOCALE_STHOUSAND
Definition: winnls.h:43
INT nDateFormat
Definition: locale.c:20
#define LOCALE_SDECIMAL
Definition: winnls.h:42
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
#define LOCALE_STIME
Definition: winnls.h:59
TCHAR cThousandSeparator
Definition: locale.c:18
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define LOCALE_SDATE
Definition: winnls.h:58
static const WCHAR szDate[]
Definition: http.c:100
GLenum GLsizei len
Definition: glext.h:6722
TCHAR cTimeSeparator
Definition: locale.c:17
INT nTimeFormat
Definition: locale.c:21
#define _stprintf
Definition: utility.h:124
#define GetDateFormat
Definition: winnls.h:1181
#define LOCALE_ITIME
Definition: winnls.h:65
int CDECL _ttoi(const _TCHAR *str)
Definition: atoi.c:10
TCHAR cDecimalSeparator
Definition: locale.c:19