名前空間
変種
操作

std::mktime

提供: cppreference.com
< cpp‎ | chrono‎ | c

 
 
ユーティリティライブラリ
支援を入力します (basic types, RTTI, type traits)
動的なメモリ管理
エラー処理
プログラムユーティリティ
可変個引数関数
日付と時刻
関数オブジェクト
initializer_list(C++11)
bitset
hash(C++11)
関係演算子
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rel_ops::operator!=
rel_ops::operator>
rel_ops::operator<=
rel_ops::operator>=
ペアとタプル
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pair
tuple(C++11)
piecewise_construct_t(C++11)
piecewise_construct(C++11)
フォワード、スワップ、および移動
Original:
Swap, forward and move
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
swap
forward(C++11)
move(C++11)
move_if_noexcept(C++11)
declval(C++11)
 
 
C形式の日付と時刻のユーティリティ
機能します
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
時間操作
Original:
Time manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
difftime
time
clock
フォーマット変換
Original:
Format conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
asctime
ctime
strftime
wcsftime
gmtime
localtime
mktime
定数
Original:
Constants
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
CLOCKS_PER_SEC
タイプ
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
tm
time_t
clock_t
 
Defined in header <ctime>
std::time_t mktime( std::tm* time );
std::time_ttime->tm_wdayの値を無視して、time->ydayオブジェクトとしてエポックからの経過時間にローカルカレンダー時刻に変換します。 timeの他の構成要素の値は、それらの通常の範囲に制限されません。 time->tm_isdstの負の値は、夏時間が有効であったかどうかを判断しようとしmktimeを起こす.
Original:
Converts local calendar time to a time since epoch as a std::time_t object, ignoring the values of time->tm_wday and time->yday. The values of other components of time are not restricted to their usual ranges. A negative value of time->tm_isdst causes mktime to attempt to determine if Daylight Saving Time was in effect.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
成功した場合、それらの適切な範囲に収まるようにtime内のすべてのフィールドを再計算し、更新.
Original:
If successful, recalculates and updates all fields in time to fit their proper ranges.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] パラメータ

time -
変換するためのローカルのカレンダー時刻を指定std::tmオブジェクトへのポインタを返します
Original:
pointer to a std::tm object specifying local calendar time to convert
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 値を返します

成功またはstd::time_t-1オブジェクトなど、エポックからの時間timestd::time_tオブジェクトとして表現できない場合.
Original:
Time since epoch as a std::time_t object on success or -1 if time cannot be represented as a std::time_t object.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集]

100ヶ月前の時間を表示します
Original:
Display the time 100 months ago
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <iostream>
#include <iomanip>
#include <ctime>
 
int main()
{
    std::time_t t = std::time(NULL);
    std::tm tm = *std::localtime(&t);
    std::cout << "Today is           " << std::put_time(&tm, "%c %Z") <<'\n';
    tm.tm_mon -= 100;
    std::mktime(&tm);
    std::cout << "100 months ago was " << std::put_time(&tm, "%c %Z") << '\n';
}

Output:

Today is           Wed Dec 28 09:56:10 2011 EST
100 months ago was Thu Aug 28 10:56:10 2003 EDT

[編集] も参照してください

現地時刻で表したカレンダー時刻をエポックからの経過時間に変換します
Original:
converts time since epoch to calendar time expressed as local time
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(機能) [edit]
C documentation for mktime