#include <stdio.h>
#include <time.h>
int main()
{
struct tm *newtime;
time_t aclock;
char *now;
time(&aclock); /* 現在時刻の獲得 */
/*
asctimeを使用した出力
*/
newtime = localtime(&aclock); /* tm構造体への変換 */
now = asctime(newtime); /* 文字列への変換 */
printf("経過時間は(aclock,秒)=%ld\n", aclock);
printf("今日の日付と現在時刻は(asctime)=%s", now);
printf("メンバーの出力\n");
printf(" tm_year %d\n", newtime -> tm_year);
printf(" tm_mon %d\n", newtime -> tm_mon);
printf(" tm_mday %d\n", newtime -> tm_mday);
/*
ctimeを使用した出力
*/
now = ctime(&aclock); /* 文字列への変換 */
printf("今日の日付と現在時刻は(ctime)=%s", now);
return 0;
}