名前空間
変種
操作

std::localtime

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

 
 
 
 
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::tm* localtime( const std::time_t *time );
現地時間で表され、カレンダー時間にstd::time_t値としてエポックからの経過時間を与えられたに変換.
Original:
Converts given time since epoch as std::time_t value into calendar time, expressed in local time.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] パラメータ

time -
変換するtime_t型のオブジェクトへのポインタ
Original:
pointer to a time_t object 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::tm上の静的内部NULLオブジェクトへのポインタ。構造はstd::gmtimestd::localtimestd::ctimeとの間で共有することができ、各呼び出しで上書きされるかもしれません.
Original:
pointer to a static internal std::tm object on success, or NULL otherwise. The structure may be shared between std::gmtime, std::localtime, and std::ctime, and may be overwritten on each invocation.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] ノート

この関数は、スレッドセーフではないかもしれません.
Original:
This function may not be thread-safe.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
POSIXは引数が大きすぎるため、それが失敗した場合、この関数はerrnoEOVERFLOW設定している必要があります.
Original:
POSIX requires that this function sets errno to EOVERFLOW if it fails because the argument is too large.
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(nullptr);
    std::cout << "UTC:   " << std::put_time(std::gmtime(&t), "%c %Z") << '\n'
              << "local: " << std::put_time(std::localtime(&t), "%c %Z") << '\n';
}

出力:

UTC:   Wed Dec 28 11:47:03 2011 GMT
local: Wed Dec 28 06:47:03 2011 EST

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

世界標準時として表現カレンダー時刻にエポックからの経過時間に変換します
Original:
converts time since epoch to calendar time expressed as Universal Coordinated 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 localtime