blob: 0cbf5345665a568bf1339b134fb3fe7a4e789b82 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
/* $Id$
*
*/
#include <pj/types.h>
#include <pj/os.h>
void pj_time_val_normalize(pj_time_val *t)
{
PJ_CHECK_STACK();
if (t->msec >= 1000) {
do {
t->sec++;
t->msec -= 1000;
} while (t->msec >= 1000);
}
else if (t->msec <= -1000) {
do {
t->sec--;
t->msec += 1000;
} while (t->msec <= -1000);
}
if (t->sec >= 1 && t->msec < 0) {
t->sec--;
t->msec += 1000;
} else if (t->sec < 0 && t->msec > 0) {
t->sec++;
t->msec -= 1000;
}
}
|