timespec_get, _timespec32_get, _timespec64_get

指定された時間の基準に基づいて、最初の引数が指す間隔を現在のカレンダーの時間に設定します。

構文

int timespec_get(
    struct timespec* const time_spec,
    int const base
);
int _timespec32_get(
    struct _timespec32* const time_spec,
    int const base
);
int _timespec64_get(
    struct _timespec64* const time_spec,
    int const base
);

パラメーター

time_spec
エポックの開始以降の時間 (秒およびナノ秒単位) に設定される構造体へのポインター。

base
時間の基準を指定する実装固有の値 (0 以外)。

戻り値

成功すると値は base になり、失敗すると 0 を返します。

解説

timespec_get 関数は、 time_spec 引数が指す構造体で現在の値を設定します。 構造体のすべてのバージョンには、 tv_sectv_nsecというメンバーが存在します。 tv_sec 値は整数の秒に設定され、 tv_nsec はナノ秒の整数に設定されます ( baseによって指定されるエポックの開始以降の、システム クロックの解像度に丸められます)。

Microsoft 固有の仕様

これらの関数は、 TIME_UTC 値として base のみをサポートしています。 TIME_UTC は、 time_spec 1970 年 1 月 1 日午前 0 時 (協定世界時) のエポック開始からの秒数とナノ秒の値を設定します。 _timespec32では、 tv_sec__time32_t 値です。 _timespec64では、 tv_sec__time64_t 値です。 timespecでは、 tv_sectime_t 型です。この長さは、プロセッサ マクロ _USE_32BIT_TIME_T が定義されているかどうかに応じて 32 ビットまたは 64 ビットになります。 このtimespec_get関数は、定義されている場合_USE_32BIT_TIME_Tに呼び出す_timespec32_getインライン関数です。それ以外の場合は呼び出します_timespec64_get

End Microsoft Specific

既定では、この関数のグローバル状態の適用対象は、アプリケーションになります。 この動作を変更するには、「CRT のグローバル状態」を参照してください

必要条件

ルーチンによって返される値 必須ヘッダー
timespec_get, _timespec32_get, _timespec64_get C: <time.h>、C++: <ctime> または <time.h>

互換性の詳細については、「 Compatibility」を参照してください。

関連項目

時間管理
asctime, _wasctime
asctime_s, _wasctime_s
_ftime, _ftime32, _ftime64
gmtime, _gmtime32, _gmtime64
gmtime_s, _gmtime32_s, _gmtime64_s
localtime, _localtime32, _localtime64
localtime_s, _localtime32_s, _localtime64_s
time, _time32, _time64
_utime, _utime32, _utime64, _wutime, _wutime32, _wutime64