「現在時刻を表示」の編集履歴(バックアップ)一覧はこちら

現在時刻を表示」(2007/10/24 (水) 20:55:31) の最新版変更点

追加された行は緑色になります。

削除された行は赤色になります。

*現在時刻を表示する。 #include <time.h> #include <stdio.h> time_t current; struct tm *local; time(&current); /* 現在の時刻を取得 */ local = localtime(&current); /* 地方時の構造体に変換 */ printf("%02d時%02d分%02d秒", local->tm_hour, local->tm_min, local->tm_sec); struct tm { int tm_sec; /* 秒 */ int tm_min; /* 分 */ int tm_hour; /* 時間 */ int tm_mday; /* 日 */ int tm_mon; /* 月 */ int tm_year; /* 年 */ int tm_wday; /* 曜日 */ int tm_yday; /* 年内通算日 */ int tm_isdst; /* 夏時間 */ };
*現在時刻を表示する。 #include <time.h> #include <stdio.h> time_t current; struct tm *local; time(&current); /* 現在の時刻を取得 */ local = localtime(&current); /* 地方時の構造体に変換 */ printf("%02d時%02d分%02d秒", local->tm_hour, local->tm_min, local->tm_sec); struct tm { int tm_sec; /* 秒 */ int tm_min; /* 分 */ int tm_hour; /* 時間 */ int tm_mday; /* 日 */ int tm_mon; /* 月 0-11 通常は+1して使用する */ int tm_year; /* 年 1900年から経った年数 通常は+1900して使用する */ int tm_wday; /* 曜日 */ int tm_yday; /* 年内通算日 */ int tm_isdst; /* 夏時間 */ };

表示オプション

横に並べて表示:
変化行の前後のみ表示: