time

Unix style time functions are available in Stratify OS as documented herein. The C standard library time functions are also available (see STDC).

Details

int gettimeofday(

struct timeval * tp,
void * tzp
)

This function gets the current time of day using the real time clock. The time is written to tp. In this implementation tzp is not used.

Returns

Zero


int _getitimer(

int which,
struct itimerval * value
)


int _setitimer(

int which,
const struct itimerval * value,
struct itimerval * ovalue
)


int settimeofday(

const struct timeval * tp,
const struct timezone * tzp
)

This function sets the current time of day to the time stored in tp. The timezone (tzp) is ignored.

Returns

Zero or -1 with errno (see Errno) set to:

  • EIO: IO error when setting the real time clock

clock_t times(

struct tms * buffer
)

This function populates buffer with the:

  • process user time
  • system time on behalf of the process
  • children process user time
  • children system time on behalf of the process

Returns

Zero or -1 with errno (see Errno) set to:

  • EINVAL: buffer is NULL

int clock_getcpuclockid(

pid_t pid,
clockid_t * clock_id
)

This function is not supported.

Returns

Zero on success or -1 with errno (see Errno) set to:

  • ENOTSUP: not supported

int clock_gettime(

clockid_t id,
struct timespec * tp
)

This function gets the time of the id clock where id is one of:

  • CLOCK_MONOTONIC
  • CLOCK_REALTIME
  • CLOCK_PROCESS_CPUTIME
  • CLOCK_THREAD_CPUTIME

Returns

Zero on success or -1 with errno (see Errno) set to:

  • EINVAL: id is not one of the above clocks or tp is NULL

int clock_getres(

clockid_t id,
struct timespec * res
)

This function gets the resolution of the id clock where id is one of:

  • CLOCK_MONOTONIC
  • CLOCK_REALTIME
  • CLOCK_PROCESS_CPUTIME
  • CLOCK_THREAD_CPUTIME

Returns

Zero on success or -1 with errno (see Errno) set to:

  • EINVAL: id is not one of the above clocks or res is NULL

int clock_settime(

clockid_t id,
const struct timespec * tp
)

This function is not supported.

Returns

Zero on success or -1 with errno (see Errno) set to:

  • ENOTSUP: not supported

unsigned int alarm(

unsigned int seconds
)

Sets an alarm that will send the SIGALRM signal to the calling process.

Parameters

  • seconds Number of seconds to elapse before alarm is sent

Returns

Zero on success


unsigned int ualarm(

useconds_t useconds,
useconds_t interval
)

Sets an alarm that will send the SIGALRM signal to the calling process.

Parameters

  • useconds Number of microseconds until the alarm happens

  • interval If non-zero, will send the alarm periodically at interval microseconds

Returns

Zero on success


int timer_create(

clockid_t clock_id,
struct sigevent * evp,
timer_t * timerid
)

Creates a timer.

Parameters

  • clock_id

  • evp

  • timerid

Returns


int timer_delete(

timer_t timerid
)

Deletes the specified timer.

Parameters

  • timerid The timer id

Returns


int timer_settime(

timer_t timerid,
int flags,
const struct itimerspec * value,
struct itimerspec * ovalue
)

Sets the time for the specified timer.

Parameters

  • timerid Timer ID

  • flags

  • value

  • ovalue

Returns


int timer_gettime(

timer_t timerid,
struct itimerspec * value
)

Parameters

  • timerid

  • value

Returns


int timer_getoverrun(

timer_t timerid
)

Parameters

  • timerid

Returns


X

Thanks for Coming!

Subscribe to news and updates