Time System Call Support

Functions

int gettimeofday(struct timeval *tv, struct timezone *tz)

Get system time.

Parameters:
  • tv – Timeval structure to fill

  • tz – Timezone structure to fill (unused)

Returns:

0 on success, -1 on error

int settimeofday(const struct timeval *tv, const struct timezone *tz)

Set system time.

Parameters:
  • tv – Time to set

  • tz – timezone (unused)

Returns:

0 on success, -1 on error

clock_t times(struct tms *buf)

get process times

Parameters:

buf – pointer to time structure tms

Returns:

On success, clock value in microseconds, On error -1 is returned

unsigned int sleep(unsigned int seconds)

sleep for a specified number of seconds

Parameters:

seconds – duration in seconds

Returns:

always return 0

int usleep(useconds_t usec)

suspend execution for microsecond intervals

Note

No task yield occurs

Parameters:

usec – duration in seconds

Returns:

always return 0

Structures

struct timeval

Time structure.

Public Members

time_t tv_sec

seconds

suseconds_t tv_usec

and microseconds

struct tms

process time details structure

Public Members

clock_t tms_utime

user time

clock_t tms_stime

system time

clock_t tms_cutime

user time of children

clock_t tms_cstime

system time of children