| 38 | } |
| 39 | |
| 40 | BOOL CreateSystemTimeString(const SYSTEMTIME *localSystemTime, |
| 41 | TCHAR *szBuffer, size_t cchMax, BOOL bFriendlyDate) |
| 42 | { |
| 43 | if (bFriendlyDate) |
| 44 | { |
| 45 | BOOL ret = CreateFriendlySystemTimeString(localSystemTime, szBuffer, cchMax); |
| 46 | |
| 47 | if (ret) |
| 48 | { |
| 49 | return TRUE; |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | TCHAR dateBuffer[512]; |
| 54 | int iReturn1 = GetDateFormat(LOCALE_USER_DEFAULT, LOCALE_USE_CP_ACP, localSystemTime, |
| 55 | NULL, dateBuffer, SIZEOF_ARRAY(dateBuffer)); |
| 56 | |
| 57 | TCHAR timeBuffer[512]; |
| 58 | int iReturn2 = GetTimeFormat(LOCALE_USER_DEFAULT, LOCALE_USE_CP_ACP, localSystemTime, |
| 59 | NULL, timeBuffer, SIZEOF_ARRAY(timeBuffer)); |
| 60 | |
| 61 | if ((iReturn1 != 0) && (iReturn2 != 0)) |
| 62 | { |
| 63 | StringCchPrintf(szBuffer, cchMax, _T("%s %s"), dateBuffer, timeBuffer); |
| 64 | return TRUE; |
| 65 | } |
| 66 | |
| 67 | return FALSE; |
| 68 | } |
| 69 | |
| 70 | BOOL CreateFriendlySystemTimeString(const SYSTEMTIME *localSystemTime, |
| 71 | TCHAR *szBuffer, size_t cchMax) |
no test coverage detected