Example: ctime

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

    #include <time.h>
    // Get Linux-style time and display as number and string
    lr_message ("Time in seconds since 1/1/70: %ld\n", time(&t));
    lr_message ("Linux-style time and date: %s", ctime(&t));
Output:
Time in seconds since 1/1/70: 1019382960
Linux-style time and date: Sun Apr 21 11:56:00 2002