diff options
author | Benny Prijono <bennylp@teluu.com> | 2005-10-31 21:02:30 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2005-10-31 21:02:30 +0000 |
commit | b5a1af6f999820564ead4867b1e5d5574778ee56 (patch) | |
tree | 8323d870699994f8b75001f961fd5e1780c0f76a /pjlib/src/pj/types.c |
initial import
git-svn-id: http://svn.pjsip.org/repos/pjproject/main@1 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pj/types.c')
-rw-r--r-- | pjlib/src/pj/types.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/pjlib/src/pj/types.c b/pjlib/src/pj/types.c new file mode 100644 index 00000000..ee1a8588 --- /dev/null +++ b/pjlib/src/pj/types.c @@ -0,0 +1,36 @@ +/* $Header: /pjproject-0.3/pjlib/src/pj/types.c 4 9/17/05 10:37a Bennylp $ */
+/* $Log: /pjproject-0.3/pjlib/src/pj/types.c $
+ *
+ * 4 9/17/05 10:37a Bennylp
+ * Major reorganization towards version 0.3.
+ *
+ */
+#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;
+ }
+}
|