gmtime_s
time.h:インデックス への移動
ヘッダー ファイル
time.h
カテゴリ
日付/時刻ルーチン
プロトタイプ
struct tm *gmtime(const time_t * _RESTRICT clock, struct tm * _RESTRICT result);
説明
カレンダ時間を UTC 時間に変換します。
gmtime_s の tm や result が NULL であってはなりません。
tm 構造体の詳細については、「gmtime」を参照してください。
戻り値
gmtime_s は、成功すれば result を、成功しなければ NULL を返します。
例
#include <stdio.h> #include <stdlib.h> #include <time.h> /* Pacific Standard Time & Daylight Savings */ char *tzstr = "TZ=PST8PDT"; int main(void) { time_t t; struct tm gmt, *area; putenv(tzstr); tzset(); t = time(NULL); area = localtime(&t); printf("Local time is: %s", asctime(area)); gmtime_s(&t, &gmt); printf("GMT is: %s", asctime(&gmt)); return 0; }
移植性
POSIX | Win32 | ANSI C | ANSI C++ |
---|---|---|---|
+ |
+ |
+ |
+ |