summaryrefslogtreecommitdiff
path: root/src/tai.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/tai.c
parent249866e3d1e11dc72eaa1305f4bb479ded92ef38 (diff)
initial clang-format
Diffstat (limited to 'src/tai.c')
-rw-r--r--src/tai.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/tai.c b/src/tai.c
index 65a8225..e83af53 100644
--- a/src/tai.c
+++ b/src/tai.c
@@ -1,6 +1,7 @@
-#include <time.h>
#include "tai.h"
+#include <time.h>
+
/**
@file tai.c
@author djb
@@ -8,21 +9,22 @@
@brief 'temps atomic' time handling
*/
-void tai_add(struct tai *t,const struct tai *u,const struct tai *v)
+void tai_add(struct tai *t, const struct tai *u, const struct tai *v)
{
t->x = u->x + v->x;
}
void tai_now(struct tai *t)
{
- tai_unix(t,time((time_t *) 0));
+ tai_unix(t, time((time_t *)0));
}
-void tai_pack(char *s,const struct tai *t)
+void tai_pack(char *s, const struct tai *t)
{
uint64 x;
x = t->x;
+ // clang-format off
s[7] = (char)x; x >>= 8;
s[6] = (char)x; x >>= 8;
s[5] = (char)x; x >>= 8;
@@ -31,23 +33,25 @@ void tai_pack(char *s,const struct tai *t)
s[2] = (char)x; x >>= 8;
s[1] = (char)x; x >>= 8;
s[0] = (char)x;
+ // clang-format on
}
-void tai_sub(struct tai *t,const struct tai *u,const struct tai *v)
+void tai_sub(struct tai *t, const struct tai *u, const struct tai *v)
{
t->x = u->x - v->x;
}
-void tai_uint(struct tai *t,unsigned int u)
+void tai_uint(struct tai *t, unsigned int u)
{
t->x = u;
}
-void tai_unpack(const char *s,struct tai *t)
+void tai_unpack(const char *s, struct tai *t)
{
uint64 x;
- x = (unsigned char) s[0];
+ x = (unsigned char)s[0];
+ // clang-format off
x <<= 8; x += (unsigned char) s[1];
x <<= 8; x += (unsigned char) s[2];
x <<= 8; x += (unsigned char) s[3];
@@ -55,5 +59,6 @@ void tai_unpack(const char *s,struct tai *t)
x <<= 8; x += (unsigned char) s[5];
x <<= 8; x += (unsigned char) s[6];
x <<= 8; x += (unsigned char) s[7];
+ // clang-format on
t->x = x;
}