94 return ((t->
sec < 4294U) || (t->
sec == 4294U && t->
usec < 967295U)) ?
95 t->
usec + t->
sec * 1000000U : UINT32_MAX;
112 return ((t->
sec < 4294967U) || (t->
sec == 4294967U && t->
usec < 295500U)) ?
113 (t->
usec + 500U) / 1000U + t->
sec * 1000U : UINT32_MAX;
128 return (t->
sec < 4294967295U || t->
usec < 500000U) ?
129 (t->
usec + 500000U) / 1000000U + t->
sec : UINT32_MAX;
141 t->
sec = t_usec / 1000000U;
142 t->
usec = t_usec % 1000000U;
154 t->
sec = t_msec / 1000U;
155 t->
usec = (t_msec % 1000U) * 1000U;
195 assert(t_now->
usec < 1000000U);
254 assert(t_start != 0);
256 assert(t_diff != t_start);
257 assert(t_diff != t_end);
267 t_diff->
sec = t_end->
sec - 1 - t_start->
sec;
268 t_diff->
usec = (1000000U - t_start->
usec) + t_end->
usec;
336 assert(t_elapsed != 0);
337 assert(t_start != 0);
338 assert(t_elapsed != t_start);
351 assert(t_start != 0);
364 assert(t_start != 0);
376 assert(t_start != 0);
400 if (t->
usec > 999999U)
497 assert(t_start != 0);
498 assert(t_timeout != 0);
502 Time_Add(&t_end, t_start, t_timeout);
This file is part of the AFBR-S50 API.
void Time_DelaySec(uint32_t dt_sec)
Time delay for a given time period in seconds.
Definition time.h:584
ltc_t Time_Now(void)
Obtains the elapsed time since MCU startup.
Definition time.h:202
bool Time_CheckTimeout(ltc_t const *t_start, ltc_t const *t_timeout)
Checks if timeout is reached from a given starting time.
Definition time.h:495
void Time_Diff(ltc_t *t_diff, ltc_t const *t_start, ltc_t const *t_end)
Obtains the time difference between two given time points.
Definition time.h:251
uint32_t Time_GetNowUSec(void)
Obtains the elapsed microseconds since MCU startup.
Definition time.h:214
uint32_t Time_ToSec(ltc_t const *t)
Converts ltc_t to seconds (uint32_t).
Definition time.h:123
uint32_t Time_GetElapsedSec(ltc_t const *t_start)
Obtains the elapsed seconds since a given time point.
Definition time.h:374
void Time_DelayMSec(uint32_t dt_msec)
Time delay for a given time period in milliseconds.
Definition time.h:574
void Time_AddMSec(ltc_t *t, ltc_t const *t1, uint32_t t2_msec)
Adds a given time in milliseconds to an ltc_t value.
Definition time.h:436
void Time_AddUSec(ltc_t *t, ltc_t const *t1, uint32_t t2_usec)
Adds a given time in microseconds to an ltc_t value.
Definition time.h:417
uint32_t Time_DiffUSec(ltc_t const *t_start, ltc_t const *t_end)
Obtains the time difference between two given time points in microseconds.
Definition time.h:282
void Time_DelayUSec(uint32_t dt_usec)
Time delay for a given time period in microseconds.
Definition time.h:564
void Time_GetElapsed(ltc_t *t_elapsed, ltc_t const *t_start)
Obtains the elapsed time since a given time point.
Definition time.h:334
bool Time_GreaterEqual(ltc_t const *t1, ltc_t const *t2)
Checks if /p t1 is greater or equal that /p t2.
Definition time.h:179
uint32_t Time_GetElapsedMSec(ltc_t const *t_start)
Obtains the elapsed milliseconds since a given time point.
Definition time.h:362
uint32_t Time_GetNowMSec(void)
Obtains the elapsed milliseconds (rounded) since MCU startup.
Definition time.h:225
void Time_FromMSec(ltc_t *t, uint32_t t_msec)
Converts milliseconds (uint32_t) to ltc_t.
Definition time.h:151
uint32_t Time_DiffSec(ltc_t const *t_start, ltc_t const *t_end)
Obtains the time difference between two given time points in seconds.
Definition time.h:315
uint32_t Time_ToMSec(ltc_t const *t)
Converts ltc_t to milliseconds (uint32_t).
Definition time.h:107
uint32_t Time_ToUSec(ltc_t const *t)
Converts ltc_t to microseconds (uint32_t).
Definition time.h:89
void Time_AddSec(ltc_t *t, ltc_t const *t1, uint32_t t2_sec)
Adds a given time in seconds to an ltc_t value.
Definition time.h:455
uint32_t Time_GetNowSec(void)
Obtains the elapsed seconds (rounded) since MCU startup.
Definition time.h:235
void Time_GetNow(ltc_t *t_now)
Obtains the elapsed time since MCU startup.
Definition time.h:191
uint32_t Time_DiffMSec(ltc_t const *t_start, ltc_t const *t_end)
Obtains the time difference between two given time points in milliseconds.
Definition time.h:299
void Time_Add(ltc_t *t, ltc_t const *t1, ltc_t const *t2)
Adds two ltc_t values.
Definition time.h:392
bool Time_CheckTimeoutUSec(ltc_t const *t_start, uint32_t const t_timeout_usec)
Checks if timeout is reached from a given starting time.
Definition time.h:513
uint32_t Time_GetElapsedUSec(ltc_t const *t_start)
Obtains the elapsed microseconds since a given time point.
Definition time.h:349
void Time_FromUSec(ltc_t *t, uint32_t t_usec)
Converts microseconds (uint32_t) to ltc_t.
Definition time.h:138
bool Time_CheckTimeoutSec(ltc_t const *t_start, uint32_t const t_timeout_sec)
Checks if timeout is reached from a given starting time.
Definition time.h:541
void Time_FromSec(ltc_t *t, uint32_t t_sec)
Converts seconds (uint32_t) to ltc_t.
Definition time.h:164
bool Time_CheckWithin(ltc_t const *t_start, ltc_t const *t_end, ltc_t const *t)
Checks if /p t is within the time interval /p t_start and /p t_end.
Definition time.h:477
bool Time_CheckTimeoutMSec(ltc_t const *t_start, uint32_t const t_timeout_msec)
Checks if timeout is reached from a given starting time.
Definition time.h:527
void Time_Delay(ltc_t const *dt)
Time delay for a given time period.
Definition time.h:553
void Timer_GetCounterValue(uint32_t *hct, uint32_t *lct)
Obtains the lifetime counter value from the timers.
A data structure to represent current time.
Definition time.h:70
uint32_t usec
Definition time.h:77
uint32_t sec
Definition time.h:73