| Maestro Audio Framework v 1.0 NXP Semiconductors

Data Structures | Typedefs | Functions
osa_time.h File Reference

Contains time function prototypes for libosa. More...

## Data Structures
struct | OsaTimeval
| Time since epoch, with microsecond resolution Represents precise time. More...

## Typedefs
typedef uint32_t | OsaTime
| Time since epoch, in seconds Same as a UNIX time_t struct. More...

## Functions
int | osa_time_get (OsaTimeval *time)
| Get the current time. More...
void | osa_time_delay (uint32_t msec)
| Suspend thread execution. More...
void | osa_time_add (OsaTimeval *time, int32_t microseconds)
| Add to time value. More...
int | osa_time_diff (const OsaTimeval *t1, const OsaTimeval *t2, OsaTimeval *diff)
| Calculate time difference. More...

## Typedef Documentation

## ◆ OsaTime

typedef uint32_t OsaTime

Represents UNIX type since epoch (Jan 1 1970). Will overflow in 2038 but shouldn't be a big deal for us.

## Function Documentation

## ◆ 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.