ReactOS 0.4.15-dev-7705-g2320c37
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% */
59{
60 static TCHAR szDate[32];
62 INT len;
64
65 len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &t, _T("ddd"), szDate, ARRAYSIZE(szDate));
66 szDate[len - 1] = _T(' ');
67 FormatDate(&szDate[len], &t, TRUE);
68 return szDate;
69}
70
71/* Return time in H:mm:ss.SS format. Used for $T in prompt and %TIME% */
74{
75 static TCHAR szTime[12];
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}
INT FormatDate(TCHAR *, LPSYSTEMTIME, BOOL)
Definition: dir.c:675
TCHAR cDateSeparator
Definition: locale.c:16
INT nTimeFormat
Definition: locale.c:21
INT nDateFormat
Definition: locale.c:20
TCHAR cTimeSeparator
Definition: locale.c:17
VOID InitLocale(VOID)
Definition: locale.c:25
INT nNumberGroups
Definition: locale.c:22
LPTSTR GetTimeString(VOID)
Definition: locale.c:73
TCHAR cThousandSeparator
Definition: locale.c:18
TCHAR cDecimalSeparator
Definition: locale.c:19
LPTSTR GetDateString(VOID)
Definition: locale.c:58
#define TRUE
Definition: types.h:120
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
GLdouble GLdouble t
Definition: gl.h:2047
GLenum GLsizei len
Definition: glext.h:6722
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 _tcscpy
Definition: tchar.h:623
#define _stprintf
Definition: utility.h:124
#define LOCALE_USER_DEFAULT
TCHAR szTime[64]
Definition: solitaire.cpp:20
int32_t INT
Definition: typedefs.h:58
#define _T(x)
Definition: vfdio.h:22
#define LOCALE_SDATE
Definition: winnls.h:58
#define LOCALE_SGROUPING
Definition: winnls.h:44
#define LOCALE_SDECIMAL
Definition: winnls.h:42
#define LOCALE_IDATE
Definition: winnls.h:63
#define GetLocaleInfo
Definition: winnls.h:1186
#define LOCALE_ITIME
Definition: winnls.h:65
#define LOCALE_STHOUSAND
Definition: winnls.h:43
#define LOCALE_SABBREVDAYNAME1
Definition: winnls.h:84
#define LOCALE_STIME
Definition: winnls.h:59
#define GetDateFormat
Definition: winnls.h:1184
char TCHAR
Definition: xmlstorage.h:189
#define _ttoi
Definition: xmlstorage.h:195
CHAR * LPTSTR
Definition: xmlstorage.h:192