Standard library header <time.h>
From cppreference.net
이 헤더는 날짜 및 시간 유틸리티 라이브러리의 일부입니다.
목차 |
함수
시간 조작 |
|
|
시간 간의 차이를 계산함
(함수) |
|
|
에포크 이후 시간으로 시스템의 현재 달력 시간을 반환함
(함수) |
|
|
프로그램 시작 이후의 원시 프로세서 클럭 시간을 반환함
(함수) |
|
|
(C11)
|
주어진 시간 기준에 따라 초와 나노초 단위의 달력 시간을 반환함
(함수) |
|
(C23)
|
주어진 시간 기준에 따른 달력 시간의 해상도를 반환함
(함수) |
형식 변환 |
|
|
(C23에서 사용 중단됨)
(C11)
|
tm
객체를 텍스트 표현으로 변환함
(함수) |
|
(C23에서 사용 중단됨)
(C11)
|
time_t
객체를 텍스트 표현으로 변환함
(함수) |
|
tm
객체를 사용자 정의 텍스트 표현으로 변환함
(함수) |
|
|
(C23)
(C11)
|
에포크 이후 시간을 협정 세계시(UTC)로 표현된 달력 시간으로 변환함
(함수) |
|
(C23)
(C11)
|
에포크 이후 시간을 현지 시간으로 표현된 달력 시간으로 변환함
(함수) |
|
달력 시간을 에포크 이후 시간으로 변환함
(함수) |
|
상수
|
1초당 프로세서 클록 틱 수
(매크로 상수) |
타입
|
달력 시간 타입
(struct) |
|
|
에포크 이후 달력 시간 타입
(typedef) |
|
|
시대 이후 프로세서 시간 타입
(typedef) |
|
|
(C11)
|
초와 나노초 단위 시간
(struct) |
시놉시스
#define __STDC_VERSION_TIME_H__ 202311L #define NULL /* 설명 참조 */ #define CLOCKS_PER_SEC /* 설명 참조 */ #define TIME_UTC /* 설명 참조 */ typedef /* 설명 참조 */ clock_t; typedef /* 설명 참조 */ size_t; typedef /* 설명 참조 */ time_t; struct timespec { /* 설명 참조 */ }; struct tm { /* 설명 참조 */ }; clock_t clock(void); double difftime(time_t time1, time_t time0); time_t mktime(struct tm* timeptr); time_t timegm(struct tm* timeptr); time_t time(time_t* timer); int timespec_get(struct timespec* ts, int base); int timespec_getres(struct timespec* ts, int base); [[deprecated]] char* asctime(const struct tm* timeptr); [[deprecated]] char* ctime(const time_t* timer); struct tm* gmtime(const time_t* timer); struct tm* gmtime_r(const time_t* timer, struct tm* buf); struct tm* localtime(const time_t* timer); struct tm* localtime_r(const time_t* timer, struct tm* buf); size_t strftime(char* restrict s, size_t maxsize, const char* restrict format, const struct tm* restrict timeptr);
구현에서 지원하는 경우에만:
#define TIME_MONOTONIC /* see description */ #define TIME_ACTIVE /* see description */
스레드가 지원되고 구현에서 지원하는 경우에만:
#define TIME_THREAD_ACTIVE /* 설명 참조 */
구현이 __STDC_LIB_EXT1__ 를 정의하고, 추가적으로 사용자 코드가 <time.h> 를 포함하기 전에 __STDC_WANT_LIB_EXT1__ 를 정의한 경우에만:
#ifdef __STDC_WANT_LIB_EXT1__ typedef /* 설명 참조 */ errno_t; typedef /* 설명 참조 */ rsize_t; errno_t asctime_s(char* s, rsize_t maxsize, const struct tm* timeptr); errno_t ctime_s(char* s, rsize_t maxsize, const time_t* timer); struct tm* gmtime_s(const time_t* restrict timer, struct tm* restrict result); struct tm* localtime_s(const time_t* restrict timer, struct tm* restrict result); #endif