Nios® V Processor Software Developer Handbook

ID 743810
Date 7/08/2024
Public
Document Table of Contents

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