Nios® V Processor Software Developer Handbook

ID 743810
Date 10/31/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

12.1.1.78. gettimeofday()

Prototype

int gettimeofday(struct timeval *ptimeval,

struct timezone *ptimezone)

Commonly Called By

C/C++ programs

Device drivers

Thread-safe

See description.

Available from ISR

Yes.

Include

<sys/time.h>

Description

The gettimeofday() function obtains a time structure that indicates the current time. This time is calculated using the elapsed number of system clock ticks, and the current time value set by the most recent call to settimeofday().

If this function is called concurrently with a call to settimeofday(), the value returned by gettimeofday() is unreliable; however, concurrent calls to gettimeofday() are legal.

Return

The return value is zero on success. If no system clock is available, the return value is -ENOTSUP.