Share this page

# gmtime

Date and Time Functions

Converts the system time into Coordinated Universal Time (UTC).

    struct tm *gmtime( const time_t *calTime);

calTime | The value for the calendar time.

Under Linux, gmtime is not thread-safe. Use gmtime_r, instead. Refer to your platform-specific documentation for details.

## Return Values

A pointer to a tm structure.

## Example

The following example gets the time as a time_t structure and converts it, using gmtime, to a tm structure in Coordinated Universal Time.

Copy code

        #include <time.h>
        time_t t;
        struct tm * gmt;
        time(&t);
        gmt = (struct tm *)gmtime(&t);
        lr_message ("Coordinated universal time:\t\t%s", asctime(gmt));

    Example: Output:
    Coordinated universal time:        Sun Apr 21 15:31:06 2002

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: