time

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

Prototypes

  • public intgettimeofday(struct timeval * tp,void * tzp)
  • public int_getitimer(int which,struct itimerval * value)
  • public int_setitimer(int which,const struct itimerval * value,struct itimerval * ovalue)
  • public intsettimeofday(const struct timeval * tp,const struct timezone * tzp)
  • public clock_ttimes(struct tms * buffer)
  • public intclock_getcpuclockid(pid_t pid,clockid_t * clock_id)
  • public intclock_gettime(clockid_t id,struct timespec * tp)
  • public intclock_getres(clockid_t id,struct timespec * res)
  • public intclock_settime(clockid_t id,const struct timespec * tp)
  • public unsigned intalarm(unsigned int seconds)
  • public unsigned intualarm(useconds_t useconds,useconds_t interval)
  • public inttimer_create(clockid_t clock_id,struct sigevent * evp,timer_t * timerid)
  • public inttimer_delete(timer_t timerid)
  • public inttimer_settime(timer_t timerid,int flags,const struct itimerspec * value,struct itimerspec * ovalue)
  • public inttimer_gettime(timer_t timerid,struct itimerspec * value)
  • public inttimer_getoverrun(timer_t timerid)

Details

public intgettimeofday(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


public int_getitimer(int which,struct itimerval * value)


public int_setitimer(int which,const struct itimerval * value,struct itimerval * ovalue)


public intsettimeofday(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

public clock_ttimes(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

public intclock_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

public intclock_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

public intclock_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

public intclock_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

public unsigned intalarm(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


public unsigned intualarm(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


public inttimer_create(clockid_t clock_id,struct sigevent * evp,timer_t * timerid)

Creates a timer.

Parameters

  • clock_id

  • evp

  • timerid

Returns


public inttimer_delete(timer_t timerid)

Deletes the specified timer. Parameters

  • timerid The timer id

Returns


public inttimer_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


public inttimer_gettime(timer_t timerid,struct itimerspec * value)

Parameters

  • timerid

  • value

Returns


public inttimer_getoverrun(timer_t timerid)

Parameters

  • timerid

Returns