gmtime_s

Aus RAD Studio
Wechseln zu: Navigation, Suche

Nach oben zu time.h - Index


Header-Datei

time.h

Kategorie

Uhrzeit- und Datumsroutinen

Prototyp

struct tm *gmtime(const time_t * _RESTRICT clock, struct tm * _RESTRICT result);

Beschreibung

Konvertiert eine kalendarische Zeitangabe in eine UTC-Zeit (Weltzeit).

Für gmtime_s dürfen tm und result nicht Null sein.

Nähere Einzelheiten zu der Struktur tm finden Sie unter gmtime.

Rückgabewert

gmtime_s gibt bei Erfolg result, ansonsten NULL zurück.

Beispiel

#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; 

}

Portabilität

POSIX Win32 ANSI C ANSI C++

+

+

+

+

Siehe auch