gmtime_r
Nach oben zu time.h
Header-Datei
time.h
Kategorie
Uhrzeit- und Datumsroutinen
Prototyp
struct tm *gmtime_r( const time_t *timer, struct tm *buf );
Beschreibung
Konvertiert eine kalendarische Zeitangabe in eine UTC-Zeit (Weltzeit).
Bei gmtime_r dürfen tm oder result nicht 0 sein.
Nähere Einzelheiten zu der Struktur tm finden Sie unter gmtime.
Rückgabewert
gmtime_r gibt bei Erfolg result, ansonsten NULL zurück.
Beispiel
#include <time.h>
#include <stdio.h>
#include <stdlib.h> // for putenv
int main()
{
time_t t = time(NULL);
struct tm tmbuf;
char buf[30];
printf("UTC: %s", asctime_r(gmtime_r(&t, &tmbuf), buf));
printf("local: %s", asctime_r(localtime_r(&t, &tmbuf), buf));
}
Portabilität
| POSIX | Win32 | ANSI C | ANSI C++ |
|---|---|---|---|
|
+ |
+ |
+ |
+ |