SystemClock

Interface to read (or set) the system clock.

You need to include “C-kern/api/time/timevalue.h” before you can use the interface.

Summary
SystemClockInterface to read (or set) the system clock.
CopyrightThis program is free software.
Files
C-kern/api/time/sysclock.hHeader file SystemClock.
C-kern/platform/Linux/time/sysclock.cImplementation file SystemClock Linux.
Enumerations
sysclock_eThis value selects the clock type.
Functions
test
unittest_time_sysclockUnittest for clock functions.
sysclock_tInterface to hardware system clock.
query
resolution_sysclockReturns the timer resolution of the underlying clock.
time_sysclockReturns the absolute time value of the underlying clock.
wait
sleep_sysclockSleeps relative_time seconds (+nanoseconds).
sleepms_sysclockSleeps millisec milliseconds.

Copyright

This program is free software.  You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

Author

© 2011 Jörg Seebohn

Files

C-kern/api/time/sysclock.h

Header file SystemClock.

C-kern/platform/Linux/time/sysclock.c

Implementation file SystemClock Linux.

Enumerations

sysclock_e

This value selects the clock type.  It specifies the properties of a clock.  For example <ostimer_t> can use any clock type to measure time.

sysclock_REALSystem-wide real-time clock.
sysclock_MONOTONICClock that cannot be set and represents monotonic time since some unspecified starting point.

Functions

Summary
test
unittest_time_sysclockUnittest for clock functions.

test

unittest_time_sysclock

int unittest_time_sysclock(void)

Unittest for clock functions.

sysclock_t

struct sysclock_t

Interface to hardware system clock.

Summary
query
resolution_sysclockReturns the timer resolution of the underlying clock.
time_sysclockReturns the absolute time value of the underlying clock.
wait
sleep_sysclockSleeps relative_time seconds (+nanoseconds).
sleepms_sysclockSleeps millisec milliseconds.

query

resolution_sysclock

int resolution_sysclock(sysclock_e clock_type,
/*out*/struct timevalue_t *resolution)

Returns the timer resolution of the underlying clock.

time_sysclock

int time_sysclock(sysclock_e clock_type,
/*out*/struct timevalue_t *clock_time)

Returns the absolute time value of the underlying clock.

wait

sleep_sysclock

int sleep_sysclock(sysclock_e clock_type,
const struct timevalue_t *relative_time)

Sleeps relative_time seconds (+nanoseconds).  The time is obtained from clock clock_type (see sysclock_e).

sleepms_sysclock

int sleepms_sysclock(sysclock_e clock_type,
uint32_t millisec)

Sleeps millisec milliseconds.  The time is obtained from clock clock_type (see sysclock_e).

Interface to read (or set) the system clock.
Implements SystemClock.
int unittest_time_sysclock(void)
Unittest for clock functions.
struct sysclock_t
Interface to hardware system clock.
int resolution_sysclock(sysclock_e clock_type,
/*out*/struct timevalue_t *resolution)
Returns the timer resolution of the underlying clock.
int time_sysclock(sysclock_e clock_type,
/*out*/struct timevalue_t *clock_time)
Returns the absolute time value of the underlying clock.
int sleep_sysclock(sysclock_e clock_type,
const struct timevalue_t *relative_time)
Sleeps relative_time seconds (+nanoseconds).
int sleepms_sysclock(sysclock_e clock_type,
uint32_t millisec)
Sleeps millisec milliseconds.
This value selects the clock type.
Close