gmtime64() — Convert Time
Format
#include <time.h>
struct tm *gmtime64(const time64_t *time);
Language Level
ILE C Extension
Threadsafe
No
Use gmtime64_r()
instead.
Description
The gmtime64()
function
breaks down the time value, in seconds,
and stores it in a tm structure, defined in <time.h>.
The value time is usually obtained by a
call to the time64()
function.
The fields of the tm structure include:
- tm_sec
- Seconds (0-61)
- tm_min
- Minutes (0-59)
- tm_hour
- Hours (0-23)
- tm_mday
- Day of month (1-31)
- tm_mon
- Month (0-11; January = 0)
- tm_year
- Year (current year minus 1900)
- tm_wday
- Day of week (0-6; Sunday = 0)
- tm_yday
- Day of year (0-365; January 1 = 0)
- tm_isdst
- Zero if daylight saving time is not in effect; positive if daylight saving time is in effect; negative if the information is not available.
Return Value
The
gmtime64()
function
returns a pointer to the resulting tm structure. Note:
- The range (0-61) for tm_sec allows for as many as two leap seconds.
- The
gmtime64()
andlocaltime64()
functions can use a common, statically allocated buffer for the conversion. Each call to one of these functions might alter the result of the previous call. Theasctime_r()
,ctime64_r()
,gmtime64_r()
, andlocaltime64_r()
functions do not use a common statically allocated buffer to hold the return string. These functions can be used in place of theasctime()
,ctime64()
,gmtime64()
, andlocaltime64()
functions if reentrancy is desired. - Calendar time is the number of seconds that have elapsed since EPOCH, which is 00:00:00, January 1, 1970 Universal Coordinate Time (UTC).
Example
This example uses the
gmtime64()
function
to adjust a time64_t
representation to a Universal
Coordinate Time character string and then converts it to a printable
string using the asctime()
function.
#include <stdio.h>
#include <time.h>
int main(void)
{
time64_t ltime;
time64(<ime);
printf ("Universal Coordinate Time is %s",
asctime(gmtime64(<ime)));
}
/************************ Output should be similar to: **********
Universal Coordinate Time is Wed Aug 18 21:01:44 1993
*/
Related Information
- asctime() — Convert Time to Character String
- asctime_r() — Convert Time to Character String (Restartable)
- ctime() — Convert Time to Character String
- ctime64() — Convert Time to Character String
- ctime64_r() — Convert Time to Character String (Restartable)
- ctime_r() — Convert Time to Character String (Restartable)
- gmtime() — Convert Time
- gmtime_r() — Convert Time (Restartable)
- gmtime64_r() — Convert Time (Restartable)
- localtime() — Convert Time
- localtime64() — Convert Time
- localtime64_r() — Convert Time (Restartable)
- localtime_r() — Convert Time (Restartable)
- mktime() — Convert Local Time
- mktime64() — Convert Local Time
- setlocale() — Set Locale
- time() — Determine Current Time
- time64() — Determine Current Time
- <time.h>