time: SCTime additions -- neq, initializer

Issue: 5818

This commit adds an initializer for the SCTime_t type and a comparison
macro for "not equal".

Use them as follows:
    SCTime_t my_var = SCTIME_INITIALIZER;
    if (SCTIME_CMP_NEQ(sctime1_val, sctime2_val)) {
    }
pull/8572/head
Jeff Lucovsky 4 years ago committed by Victor Julien
parent 08b17e9778
commit 59ab1c20ec

@ -47,6 +47,12 @@ typedef struct {
(t).secs = 0; \
(t).usecs = 0; \
}
#define SCTIME_INITIALIZER \
(SCTime_t) \
{ \
.secs = 0, .usecs = 0 \
}
#define SCTIME_USECS(t) ((uint64_t)(t).usecs)
#define SCTIME_SECS(t) ((uint64_t)(t).secs)
#define SCTIME_MSECS(t) (SCTIME_SECS(t) * 1000 + SCTIME_USECS(t) / 1000)
@ -83,6 +89,7 @@ typedef struct {
#define SCTIME_CMP_GT(a, b) SCTIME_CMP((a), (b), >)
#define SCTIME_CMP_LT(a, b) SCTIME_CMP((a), (b), <)
#define SCTIME_CMP_LTE(a, b) SCTIME_CMP((a), (b), <=)
#define SCTIME_CMP_NEQ(a, b) SCTIME_CMP((a), (b), !=)
void TimeInit(void);
void TimeDeinit(void);

Loading…
Cancel
Save