Nios® II Software Developer Handbook

ID 683525
Date 8/28/2023
Public
Document Table of Contents

15.1.80. 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.