ReactOS  0.4.14-dev-358-gbef841c
locale.c File Reference
#include "precomp.h"
Include dependency graph for locale.c:

Go to the source code of this file.

Functions

VOID InitLocale (VOID)
 
LPTSTR GetDateString (VOID)
 
LPTSTR GetTimeString (VOID)
 

Variables

TCHAR cDateSeparator
 
TCHAR cTimeSeparator
 
TCHAR cThousandSeparator
 
TCHAR cDecimalSeparator
 
INT nDateFormat
 
INT nTimeFormat
 
INT nNumberGroups
 

Function Documentation

◆ GetDateString()

LPTSTR GetDateString ( VOID  )

Definition at line 58 of file locale.c.

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 }
#define TRUE
Definition: types.h:120
#define LOCALE_USER_DEFAULT
GLdouble GLdouble t
Definition: gl.h:2047
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
INT FormatDate(TCHAR *, LPSYSTEMTIME, BOOL)
Definition: dir.c:674
int32_t INT
Definition: typedefs.h:56
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:276
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
static const WCHAR szDate[]
Definition: http.c:99
GLenum GLsizei len
Definition: glext.h:6722
#define GetDateFormat
Definition: winnls.h:1181

Referenced by cmd_date(), GetEnvVarOrSpecial(), and PrintPrompt().

◆ GetTimeString()

LPTSTR GetTimeString ( VOID  )

Definition at line 73 of file locale.c.

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 }
TCHAR szTime[64]
Definition: solitaire.cpp:18
GLdouble GLdouble t
Definition: gl.h:2047
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:276
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
TCHAR cTimeSeparator
Definition: locale.c:17
#define _stprintf
Definition: utility.h:124
TCHAR cDecimalSeparator
Definition: locale.c:19

Referenced by cmd_time(), CommandTimer(), GetEnvVarOrSpecial(), and PrintPrompt().

◆ InitLocale()

VOID InitLocale ( VOID  )

Definition at line 25 of file locale.c.

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 }
#define LOCALE_SGROUPING
Definition: winnls.h:44
TCHAR cDateSeparator
Definition: locale.c:16
#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
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
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
#define LOCALE_STIME
Definition: winnls.h:59
TCHAR cThousandSeparator
Definition: locale.c:18
char TCHAR
Definition: xmlstorage.h:189
#define LOCALE_SDATE
Definition: winnls.h:58
TCHAR cTimeSeparator
Definition: locale.c:17
INT nTimeFormat
Definition: locale.c:21
#define LOCALE_ITIME
Definition: winnls.h:65
int CDECL _ttoi(const _TCHAR *str)
Definition: atoi.c:10
TCHAR cDecimalSeparator
Definition: locale.c:19

Referenced by cmd_start(), Execute(), and Initialize().

Variable Documentation

◆ cDateSeparator

TCHAR cDateSeparator

Definition at line 16 of file locale.c.

Referenced by FormatDate(), InitLocale(), PrintDateString(), and ReadSeparator().

◆ cDecimalSeparator

TCHAR cDecimalSeparator

Definition at line 19 of file locale.c.

Referenced by CommandTimer(), GetTimeString(), InitLocale(), ParseTime(), and PrintElapsedTime().

◆ cThousandSeparator

TCHAR cThousandSeparator

Definition at line 18 of file locale.c.

Referenced by ConvertULargeInteger(), and InitLocale().

◆ cTimeSeparator

TCHAR cTimeSeparator

◆ nDateFormat

INT nDateFormat

Definition at line 20 of file locale.c.

Referenced by FormatDate(), InitLocale(), ParseDate(), and PrintDateString().

◆ nNumberGroups

INT nNumberGroups

Definition at line 22 of file locale.c.

Referenced by ConvertULargeInteger(), and InitLocale().

◆ nTimeFormat

INT nTimeFormat

Definition at line 21 of file locale.c.

Referenced by FormatTime(), InitLocale(), and ParseTime().