fix a small bug, write out time like HH:MM:SS,ms as ms cmd does.

svn path=/trunk/; revision=16681
This commit is contained in:
Magnus Olsen 2005-07-21 16:28:20 +00:00
parent 0d62ee8f06
commit 58f5ef812e
3 changed files with 17 additions and 13 deletions

View file

@ -1035,8 +1035,11 @@ ProcessInput (BOOL bFlag)
/* %TIME% */
else if (_tcsicmp(ip,_T("time")) ==0)
{
TCHAR szTime[40];
GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, NULL, szTime, sizeof(szTime));
TCHAR szTime[40];
SYSTEMTIME t;
GetSystemTime(&t);
_sntprintf(szTime ,40,_T("%02d%c%02d%c%02d%c%02d"), t.wHour, cTimeSeparator,t.wMinute , cTimeSeparator,t.wSecond , cDecimalSeparator, t.wMilliseconds );
cp = _stpcpy (cp, szTime);
}

View file

@ -70,12 +70,12 @@ VOID PrintDate (VOID)
VOID PrintTime (VOID)
{
TCHAR szMsg[RC_STRING_MAX_SIZE];
TCHAR szTime[32];
GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, NULL,
szTime, sizeof(szTime));
TCHAR szMsg[RC_STRING_MAX_SIZE];
SYSTEMTIME t;
GetSystemTime(&t);
LoadString(CMD_ModuleHandle, STRING_LOCALE_HELP1, szMsg, RC_STRING_MAX_SIZE);
ConOutPrintf(_T("%s: %s\n"), szMsg, szTime);
ConOutPrintf(_T("%s: %02d%c%02d%c%02d%c%02d\n"), szMsg, t.wHour, cTimeSeparator,
t.wMinute , cTimeSeparator,
t.wSecond , cDecimalSeparator, t.wMilliseconds );
}

View file

@ -138,10 +138,11 @@ VOID PrintPrompt(VOID)
break;
case _T('T'):
{
TCHAR szTime[32];
GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, NULL,szTime, sizeof(szTime));
ConOutPrintf("%s",szTime);
{
SYSTEMTIME t;
GetSystemTime(&t);
ConOutPrintf(_T("%02d%c%02d%c%02d%c%02d\n"),t.wHour, cTimeSeparator,t.wMinute , cTimeSeparator,
t.wSecond , cDecimalSeparator, t.wMilliseconds );
}
break;