Share this page

# time

Date and Time Functions

Returns the system time.

    time_t time( time_t *timeptr);

timeptr | Pointer to long integer that will store the time.

## Return Values

The time function returns the number of seconds elapsed since midnight (00:00:00), January 1, 1970, coordinated universal time (UTC), according to the system clock. The return value is stored in the location given by timeptr. If timeptr is NULL the value is not stored.

## Example

The following example prints out the system time using time. It then prints the same time value in Linux-style format.

        #include <time.h>
        time_t t;

        // Get system time and display as number and string

        lr_message ("Time in seconds since 1/1/70: %ld\n", time(&t));
        lr_message ("Formatted time and date: %s", ctime(&t));

    Example: Output:
    Time in seconds since 1/1/70: 1019382960
    Formatted time and date: Sun Apr 21 11:56:00 2002

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