renamed some time functions - e.g. qse_addtime to qse_add_ntime, qse_subtime to qse_sub_ntime, etc

moved the position of result parameter from the third position to the first position in qse_add_ntime() and qse_sub_ntime()
This commit is contained in:
2020-09-10 15:57:11 +00:00
parent 1c39537b44
commit d8247f8a6f
12 changed files with 55 additions and 55 deletions

View File

@ -614,7 +614,7 @@ int qse_timelocal (const qse_btime_t* bt, qse_ntime_t* nt)
return 0;
}
void qse_addtime (const qse_ntime_t* x, const qse_ntime_t* y, qse_ntime_t* z)
void qse_add_ntime (qse_ntime_t* z, const qse_ntime_t* x, const qse_ntime_t* y)
{
QSE_ASSERT (x->nsec >= 0 && x->nsec < QSE_NSECS_PER_SEC);
QSE_ASSERT (y->nsec >= 0 && y->nsec < QSE_NSECS_PER_SEC);
@ -679,7 +679,7 @@ void qse_addtime (const qse_ntime_t* x, const qse_ntime_t* y, qse_ntime_t* z)
#endif
}
void qse_subtime (const qse_ntime_t* x, const qse_ntime_t* y, qse_ntime_t* z)
void qse_sub_ntime (qse_ntime_t* z, const qse_ntime_t* x, const qse_ntime_t* y)
{
QSE_ASSERT (x->nsec >= 0 && x->nsec < QSE_NSECS_PER_SEC);
QSE_ASSERT (y->nsec >= 0 && y->nsec < QSE_NSECS_PER_SEC);

View File

@ -31,7 +31,7 @@
#define HEAP_LEFT(x) ((x) * 2 + 1)
#define HEAP_RIGHT(x) ((x) * 2 + 2)
#define YOUNGER_THAN(x,y) (qse_cmptime(&(x)->when, &(y)->when) < 0)
#define YOUNGER_THAN(x,y) (qse_cmp_ntime(&(x)->when, &(y)->when) < 0)
qse_tmr_t* qse_tmr_open (qse_mmgr_t* mmgr, qse_size_t xtnsize, qse_size_t capa)
{
@ -236,11 +236,11 @@ int qse_tmr_fire (qse_tmr_t* tmr, const qse_ntime_t* tm, qse_size_t* firecnt)
/* if the current time is not specified, get it from the system */
if (tm) now = *tm;
else if (qse_gettime (&now) <= -1) return -1;
else if (qse_gettime(&now) <= -1) return -1;
while (tmr->size > 0)
{
if (qse_cmptime(&tmr->event[0].when, &now) > 0) break;
if (qse_cmp_ntime(&tmr->event[0].when, &now) > 0) break;
event = tmr->event[0];
qse_tmr_delete (tmr, 0); /* remove the registered event structure */
@ -262,10 +262,10 @@ int qse_tmr_gettmout (qse_tmr_t* tmr, const qse_ntime_t* tm, qse_ntime_t* tmout)
/* if the current time is not specified, get it from the system */
if (tm) now = *tm;
else if (qse_gettime (&now) <= -1) return -1;
else if (qse_gettime(&now) <= -1) return -1;
qse_subtime (&tmr->event[0].when, &now, tmout);
if (tmout->sec < 0) qse_cleartime (tmout);
qse_sub_ntime (tmout, &tmr->event[0].when, &now);
if (qse_is_neg_ntime(tmout)) qse_clear_ntime (tmout);
return 0;
}