StrFromTimeIntervalA 함수(shlwapi.h)
밀리초 단위로 지정된 시간 간격을 문자열로 변환합니다.
통사론
int StrFromTimeIntervalA(
[out] PSTR pszOut,
UINT cchMax,
DWORD dwTimeMS,
int digits
);
매개 변수
[out] pszOut
형식: PTSTR
이 함수가 성공적으로 반환될 때 변환된 번호를 수신하는 버퍼에 대한 포인터입니다.
cchMax
형식: UINT
pszOut
dwTimeMS
형식: DWORD
시간 간격(밀리초)입니다.
digits
형식: int
pszOut나타낼 최대 유효 자릿수입니다. 몇 가지 예는 다음과 같습니다.
dwTimeMS | 자리 | pszOut |
---|---|---|
34000 | 3 | 34초 |
34000 | 2 | 34초 |
34000 | 1 | 30초 |
74000 | 3 | 1분 14초 |
74000 | 2 | 1분 10초 |
74000 | 1 | 1분 |
반환 값
형식: int
종료 NULL 문자를 제외하고 pszOut문자 수를 반환합니다.
발언
pszOut 반환된 시간 값은 항상 hh 시간 mm 분 ss 초 형식입니다. 24시간을 초과하는 시간은 일 또는 월로 변환되지 않습니다. 초의 분수는 무시됩니다.
예제
#include <windows.h>
#include <iostream.h>
#include "Shlwapi.h"
void main(void)
{
char TimeString[256];
char *pszOut;
pszOut = TimeString;
cout << "The return value from the call to"
<< "\nthe function StrFromTimeInterval will"
<< "\nreturn the number of elements in the buffer: " << endl;
cout << "\nThe return from StrFromTimeInterval is "
<< StrFromTimeInterval(pszOut,30, 34000,30);
cout << "\nThe contents of the TimeString Buffer " << pszOut << endl;
cout << "The return from StrFromTimeInterval is "
<< StrFromTimeInterval(pszOut,30, 74000,3);
cout << "\nThe contents of the TimeString Buffer " << pszOut << endl;
cout << "The return from StrFromTimeInterval is "
<< StrFromTimeInterval(pszOut,30, 74000,2);
cout << "\nThe contents of the TimeString Buffer " << pszOut << endl;
cout << "The return from StrFromTimeInterval is "
<< StrFromTimeInterval(pszOut,30, 74000,1)
<< "\nThe contents of the TimeString Buffer " << pszOut << endl;
}
OUTPUT:
- - - - -
The return value from the call to
the function StrFromTimeInterval will
return the number of elements in the buffer:
The return from StrFromTimeInterval is 7
The contents of the TimeString Buffer 34 sec
The return from StrFromTimeInterval is 13
The contents of the TimeString Buffer 1 min 14 sec
The return from StrFromTimeInterval is 13
The contents of the TimeString Buffer 1 min 10 sec
The return from StrFromTimeInterval is 6
The contents of the TimeString Buffer 1 min
메모
shlwapi.h 헤더는 STRFromTimeInterval을 유니코드 전처리기 상수의 정의에 따라 이 함수의 ANSI 또는 유니코드 버전을 자동으로 선택하는 별칭으로 정의합니다. 인코딩 중립 별칭을 인코딩 중립이 아닌 코드와 혼합하면 컴파일 또는 런타임 오류가 발생하는 불일치가 발생할 수 있습니다. 자세한 내용은 함수 프로토타입대한
요구 사항
요구 | 값 |
---|---|
지원되는 최소 클라이언트 | Windows 2000 Professional, Windows XP [데스크톱 앱만 해당] |
지원되는 최소 서버 | Windows 2000 Server [데스크톱 앱만 해당] |
대상 플랫폼 | Windows |
헤더 | shlwapi.h |
라이브러리 | Shlwapi.lib |
DLL | Shlwapi.dll(버전 4.71 이상) |