Skip to main content

Time

More...

Functions#

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

Attributes#

Name
struct timeval time_of_day_offsetMCU_SYS_MEM

Detailed Description#

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

Functions Documentation#

gettimeofday#

int gettimeofday(    struct timeval * tp,    void * tzp)

Return: Zero

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.

_getitimer#

int _getitimer(    int which,    struct itimerval * value)

_setitimer#

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

settimeofday_rtc#

static int settimeofday_rtc(    const struct timeval * tp)

_settimeofday#

int _settimeofday(    const struct timeval * tp,    const struct timezone * tzp)

settimeofday#

int settimeofday(    const struct timeval * tp,    const struct timezone * tzp)

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

  • EIO: IO error when setting the real time clock

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

times#

clock_t times(    struct tms * buffer)

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

  • EINVAL: buffer is NULL

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

clock_getcpuclockid#

int clock_getcpuclockid(    pid_t pid,    clockid_t * clock_id)

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

  • ENOTSUP: not supported

This function is not supported.

clock_gettime#

int clock_gettime(    clockid_t id,    struct timespec * tp)

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

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

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

  • CLOCK_MONOTONIC
  • CLOCK_REALTIME
  • CLOCK_PROCESS_CPUTIME
  • CLOCK_THREAD_CPUTIME

TodoThis should be an uninterruptable read

clock_getres#

int clock_getres(    clockid_t id,    struct timespec * res)

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

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

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

  • CLOCK_MONOTONIC
  • CLOCK_REALTIME
  • CLOCK_PROCESS_CPUTIME
  • CLOCK_THREAD_CPUTIME

clock_settime#

int clock_settime(    clockid_t id,    const struct timespec * tp)

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

  • ENOTSUP: not supported

This function is not supported.

alarm#

unsigned int alarm(    unsigned int seconds)

Parameters:

  • seconds Number of seconds to elapse before alarm is sent

Return: Zero on success

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

ualarm#

unsigned int ualarm(    useconds_t useconds,    useconds_t interval)

Parameters:

  • useconds Number of microseconds until the alarm happens
  • interval If non-zero, will send the alarm periodically at interval microseconds

Return: Zero on success

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

timer_create#

int timer_create(    clockid_t clock_id,    struct sigevent * evp,    timer_t * timerid)

Parameters:

  • clock_id Must be CLOCK_REALTIME
  • evp The signal event to send when the timer fires
  • timerid A valie to write for the timer_t that is created

Return:

Creates a timer.

timer_delete#

int timer_delete(    timer_t timerid)

Parameters:

  • timerid The timer id

Return: Zero on success or -1 with errno set to:

  • EINVAL: timerid is not valid

Deletes the specified timer.

timer_settime#

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

Parameters:

  • timerid Timer ID
  • flags
  • value
  • ovalue

Return:

Sets the time for the specified timer.

timer_gettime#

int timer_gettime(    timer_t timerid,    struct itimerspec * value)

Parameters:

  • timerid
  • value

Return:

Gets the time from a timer

timer_getoverrun#

int timer_getoverrun(    timer_t timerid)

timer_getoverrun

Parameters:

  • timerid

Return:

Attributes Documentation#

MCU_SYS_MEM#

struct timeval time_of_day_offset MCU_SYS_MEM;

Updated on 18 September 2021 at 21:44:10 MDT