summaryrefslogtreecommitdiff
path: root/src/taia.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-09 14:41:53 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-09 14:41:53 +0200
commit5fadc0cbb8577c61d66bd6f19ceaf0507c11e23b (patch)
tree684758441f5b431d0008253243034b6a4a29417c /src/taia.c
parent249866e3d1e11dc72eaa1305f4bb479ded92ef38 (diff)
initial clang-format
Diffstat (limited to 'src/taia.c')
-rw-r--r--src/taia.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/src/taia.c b/src/taia.c
index 22bd816..3b8cb8a 100644
--- a/src/taia.c
+++ b/src/taia.c
@@ -1,7 +1,8 @@
-#include <sys/types.h>
-#include <sys/time.h>
#include "taia.h"
+#include <sys/time.h>
+#include <sys/types.h>
+
/**
@file taia.c
@author djb
@@ -11,7 +12,7 @@
/* XXX: breaks tai encapsulation */
-void taia_add(struct taia *t,struct taia *u,struct taia *v)
+void taia_add(struct taia *t, struct taia *u, struct taia *v)
{
t->sec.x = u->sec.x + v->sec.x;
t->nano = u->nano + v->nano;
@@ -36,7 +37,7 @@ double taia_frac(struct taia *t)
return (t->atto * 0.000000001 + t->nano) * 0.000000001;
}
-int taia_less(struct taia *t,struct taia *u)
+int taia_less(struct taia *t, struct taia *u)
{
if (t->sec.x < u->sec.x) return 1;
if (t->sec.x > u->sec.x) return 0;
@@ -48,8 +49,8 @@ int taia_less(struct taia *t,struct taia *u)
int taia_now(struct taia *t)
{
struct timeval now;
- if (gettimeofday(&now,(struct timezone *) 0) == 0) {
- tai_unix(&t->sec,now.tv_sec);
+ if (gettimeofday(&now, (struct timezone *)0) == 0) {
+ tai_unix(&t->sec, now.tv_sec);
t->nano = 1000 * now.tv_usec + 500;
t->atto = 0;
return 0;
@@ -59,26 +60,32 @@ int taia_now(struct taia *t)
return -1;
}
-void taia_pack(char *s,struct taia *t)
+void taia_pack(char *s, struct taia *t)
{
unsigned long x;
- tai_pack(s,&t->sec);
+ tai_pack(s, &t->sec);
s += 8;
x = t->atto;
- s[7] = x & 255; x >>= 8;
- s[6] = x & 255; x >>= 8;
- s[5] = x & 255; x >>= 8;
+ s[7] = x & 255;
+ x >>= 8;
+ s[6] = x & 255;
+ x >>= 8;
+ s[5] = x & 255;
+ x >>= 8;
s[4] = x;
x = t->nano;
- s[3] = x & 255; x >>= 8;
- s[2] = x & 255; x >>= 8;
- s[1] = x & 255; x >>= 8;
+ s[3] = x & 255;
+ x >>= 8;
+ s[2] = x & 255;
+ x >>= 8;
+ s[1] = x & 255;
+ x >>= 8;
s[0] = x;
}
-void taia_sub(struct taia *t,struct taia *u,struct taia *v)
+void taia_sub(struct taia *t, struct taia *u, struct taia *v)
{
unsigned long unano = u->nano;
unsigned long uatto = u->atto;
@@ -96,7 +103,7 @@ void taia_sub(struct taia *t,struct taia *u,struct taia *v)
}
}
-void taia_uint(struct taia *t,unsigned int s)
+void taia_uint(struct taia *t, unsigned int s)
{
t->sec.x = s;
t->nano = 0;