time.h
|
---|
その |
この |
time.hは、time.h
では、システム
機能 の概要
[Ctime.h
ヘッダファイル[
difftime
|
2つのtime_t | |
time
|
time_t | |
clock
|
プロセスに | |
timespec_get (C11)
|
||
asctime
|
struct tm | |
ctime
|
time_t | |
strftime
|
struct tm | |
strptime
|
struct tm struct tm | |
wcsftime
|
struct tm | |
gmtime
|
time_t | |
localtime
|
time_t | |
mktime
|
カレンダーtime_t | |
CLOCKS_PER_SEC
|
1 | |
TIME_UTC
|
||
データ |
struct tm
|
カレンダー |
time_t
|
||
clock_t
|
CPU | |
timespec
|
timespec
TIME_UTC
のみがstd::chrono
に
例
[#include <time.h>
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
time_t current_time;
char* c_time_string;
/* Obtain current time. */
current_time = time(NULL);
if (current_time == ((time_t)-1))
{
(void) fprintf(stderr, "Failure to obtain the current time.\n");
exit(EXIT_FAILURE);
}
/* Convert to local time format. */
c_time_string = ctime(¤t_time);
if (c_time_string == NULL)
{
(void) fprintf(stderr, "Failure to convert the current time.\n");
exit(EXIT_FAILURE);
}
/* Print to stdout. ctime() has already added a terminating newline character. */
(void) printf("Current time is %s", c_time_string);
exit(EXIT_SUCCESS);
}
Current time is Thu Sep 15 21:18:23 2016
脚注
[注釈
[出典
[- ^ ISO/IEC 9899:1999 specification. p. 351, § 7.32.2
- ^ open-std.org - Committee Draft -- May 6, 2005 page 355
- ^ Markus Kuhn. “Modernized API for ISO C”. cl.cam.ac.uk. 2023
年 11月30日 閲覧 。