Contains time function prototypes for libosa.
More...
|
struct | OsaTimeval |
| Time since epoch, with microsecond resolution Represents precise time. More...
|
|
|
typedef uint32_t | OsaTime |
| Time since epoch, in seconds Same as a UNIX time_t struct. More...
|
|
◆ OsaTime
Represents UNIX type since epoch (Jan 1 1970). Will overflow in 2038 but shouldn't be a big deal for us.
◆ osa_time_get()
int osa_time_get |
( |
OsaTimeval * |
time | ) |
|
Retrieve the current time. This function behaves like POSIX gettimeofday(), without the timezone. For MQX, this returns the time since MQX started running.
- Parameters
-
time | Output parameter of type OsaTimeval stores the current time. It contains tv_usec which will contain the time in microseconds. and tv_sec which will contain the time in seconds. |
- Return values
-
ERRCODE_NO_ERROR | This function will always succeed for MQX and Linux. |
◆ osa_time_delay()
void osa_time_delay |
( |
uint32_t |
msec | ) |
|
Block the current task for the specified number of milliseconds
- Parameters
-
msec | Number of milliseconds to block. This should not be below 5 milliseconds since the resolution of the OS may not support less. |
◆ osa_time_add()
void osa_time_add |
( |
OsaTimeval * |
time, |
|
|
int32_t |
microseconds |
|
) |
| |
Add a positive or negative number of microseconds to 'time'.
- Parameters
-
time | Current time |
microseconds | Number of usec to add to the time parameter |
◆ osa_time_diff()
int osa_time_diff |
( |
const OsaTimeval * |
t1, |
|
|
const OsaTimeval * |
t2, |
|
|
OsaTimeval * |
diff |
|
) |
| |
Return the number of seconds elapsed between time 't1' and 't2'.
- Parameters
-
t1 | Starting time |
t2 | Ending time |
diff | Time difference |
- Return values
-
ERRCODE_NO_ERROR | This function will always succeed for MQX and Linux. |