|
SuperTinyKernel™ RTOS 1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
|
POSIX <sys/time.h> extension for STK: gettimeofday(). Implemented by stk_c_pthread.cpp, together with time() of <time.h>. More...
Go to the source code of this file.
Macros | |
| #define | _SYS__PTHREADTYPES_H_ |
| #define | STK_C_PTHREADTYPES_GUARD |
Functions | |
| int | gettimeofday (struct timeval *tv, void *tz) |
| Get the wall time (microsecond fields, tick resolution). | |
| int | settimeofday (const struct timeval *tv, const struct timezone *tz) |
| Set the wall time (microsecond precision): the offset of time() / gettimeofday() is changed, the kernel timeline of clock_gettime() and of all deadlines is not (see the file description). | |
POSIX <sys/time.h> extension for STK: gettimeofday(). Implemented by stk_c_pthread.cpp, together with time() of <time.h>.
This header EXTENDS the toolchain's <sys/time.h> (included first via #include_next on GCC/Clang, or the header named by STK_C_SYSTEM_SYS_TIME_H on other compilers).
Wall time: STK has no real-time clock. gettimeofday() and time() report the kernel time since start plus an offset which is 0 until the application sets the current Unix time with stk_posix_set_wall_time() (declared in time.h; e.g. after reading an RTC or a network time). The offset applies ONLY to gettimeofday() and time(): clock_gettime(), all absolute deadlines (pthread_cond_timedwait(), sem_timedwait(), mq_timedreceive(), ...) and TIMER_ABSTIME stay on the kernel timeline, so do not derive such a deadline from gettimeofday()/time().
These functions replace the ones of the C library (newlib's gettimeofday()/time() end in a system call stub), the object file of this shim must be linked before libc.
Definition in file sys/time.h.
| #define _SYS__PTHREADTYPES_H_ |
Definition at line 32 of file sys/time.h.
| #define STK_C_PTHREADTYPES_GUARD |
Definition at line 33 of file sys/time.h.
| int gettimeofday | ( | struct timeval * | tv, |
| void * | tz ) |
Get the wall time (microsecond fields, tick resolution).
| [out] | tv | Receives the time since the Unix epoch (see the file description for what that means on STK). |
| [in] | tz | Obsolete, ignored. |
Definition at line 3384 of file stk_c_pthread.cpp.
References STK_UNUSED, and WallTimeUs().
| int settimeofday | ( | const struct timeval * | tv, |
| const struct timezone * | tz ) |
Set the wall time (microsecond precision): the offset of time() / gettimeofday() is changed, the kernel timeline of clock_gettime() and of all deadlines is not (see the file description).
| [in] | tv | New time since the Unix epoch. |
| [in] | tz | Obsolete, ignored. |
tv_usec outside 0..999999. Definition at line 3365 of file stk_c_pthread.cpp.
References SetWallTimeUs(), and STK_UNUSED.