gmtime, gmtime_r

Converts a time value into Coordinated Universal Time (UTC).

Library:LibC
Classification:ANSI
Service:Time

Syntax

  #include <time.h> 
   
  struct tm *gmtime (
     const time_t  *calendar);
  
  struct tm *gmtime_r (
    const time_t   *calendar,   
    struct tm      *localtime);
  

Parameters

calendar

(IN) Points to the time, in seconds since the epoch began, to convert to UTC.

localtime

(OUT) Points to a tm structure for the converted string.

Return Values

Returns a pointer to a tm structure containing the time information.

Remarks

The gmtime and gmtime_r functions convert the time pointed to by the calendar parameter into a broken-down time, expressed as UTC.

The structure returned is reused every time that gmtime and gmtime_r are called.

The gmtime_r function provides the same functionality as gmtime, but gmtime_r is designed for use with reentrant NLM applications. The gmtime_r function allows the caller to pass storage for the results rather than relying on per-thread data.

See Also