os_gettimeofday

int os_gettimeofday(struct os_timeval *utctime, struct os_timezone *timezone); 

Arguments

ArgumentsDescription
utctimeUTC time corresponding to wallclock time
timezoneTimezone to convert UTC time to wallclock time

Returned values

Returns 0 on success and non-zero on failure.

Notes

utctime or timezone may be NULL.

The function is a no-op if both utctime and timezone are NULL.

Example

    /*
     * Display wallclock time on the console.
     */
    int rc;
    struct os_timeval utc;
    struct os_timezone tz;
    char buf[DATETIME_BUFSIZE];
    
    rc = os_gettimeofday(&utc, &tz);
    if (rc == 0) {
        format_datetime(&utc, &tz, buf, sizeof(buf));
        console_printf("%s\n", buf);
    }