GetFormattedTime
1
PCHAR
2 GetFormattedTime(
3 BOOL bDateToo
4 )
5 {
6 static char szTime[ 64 ];
7 int cch = 0 ;
8
9 if (bDateToo) {
10
11 cch =
12 GetDateFormat(
13 LOCALE_USER_DEFAULT,
14 0 ,
15 NULL, // current date
16 " ddd " , // short day of week
17 szTime,
18 sizeof szTime
19 );
20
21 // cch includes null terminator, change it to
22 // a space to separate from time.
23
24 szTime[ cch - 1 ] = ' ' ;
25 }
26
27 //
28 // Get time and format to characters
29 //
30
31 GetTimeFormat(
32 LOCALE_USER_DEFAULT,
33 TIME_NOSECONDS,
34 NULL, // use current time
35 NULL, // use default format
36 szTime + cch,
37 ( sizeof szTime) - cch );
38
39 return szTime;
40 }
41
2 GetFormattedTime(
3 BOOL bDateToo
4 )
5 {
6 static char szTime[ 64 ];
7 int cch = 0 ;
8
9 if (bDateToo) {
10
11 cch =
12 GetDateFormat(
13 LOCALE_USER_DEFAULT,
14 0 ,
15 NULL, // current date
16 " ddd " , // short day of week
17 szTime,
18 sizeof szTime
19 );
20
21 // cch includes null terminator, change it to
22 // a space to separate from time.
23
24 szTime[ cch - 1 ] = ' ' ;
25 }
26
27 //
28 // Get time and format to characters
29 //
30
31 GetTimeFormat(
32 LOCALE_USER_DEFAULT,
33 TIME_NOSECONDS,
34 NULL, // use current time
35 NULL, // use default format
36 szTime + cch,
37 ( sizeof szTime) - cch );
38
39 return szTime;
40 }
41