clang-format

This commit is contained in:
2024-09-10 13:03:02 -04:00
parent 53c617d779
commit d66450e427
381 changed files with 28864 additions and 34170 deletions

View File

@@ -33,37 +33,31 @@
/*
* ts1 + ts2
*/
void
timespec_add(const struct timespec *ts1,
const struct timespec *ts2,
struct timespec *ret)
{
ret->tv_nsec = ts1->tv_nsec + ts2->tv_nsec;
ret->tv_sec = ts1->tv_sec + ts2->tv_sec;
if (ret->tv_nsec >= 1000000000) {
ret->tv_nsec -= 1000000000;
ret->tv_sec += 1;
}
void timespec_add(const struct timespec *ts1, const struct timespec *ts2,
struct timespec *ret) {
ret->tv_nsec = ts1->tv_nsec + ts2->tv_nsec;
ret->tv_sec = ts1->tv_sec + ts2->tv_sec;
if (ret->tv_nsec >= 1000000000) {
ret->tv_nsec -= 1000000000;
ret->tv_sec += 1;
}
}
/*
* ts1 - ts2
*/
void
timespec_sub(const struct timespec *ts1,
const struct timespec *ts2,
struct timespec *ret)
{
/* in case ret and ts1 or ts2 are the same */
struct timespec r;
void timespec_sub(const struct timespec *ts1, const struct timespec *ts2,
struct timespec *ret) {
/* in case ret and ts1 or ts2 are the same */
struct timespec r;
r = *ts1;
if (r.tv_nsec < ts2->tv_nsec) {
r.tv_nsec += 1000000000;
r.tv_sec--;
}
r = *ts1;
if (r.tv_nsec < ts2->tv_nsec) {
r.tv_nsec += 1000000000;
r.tv_sec--;
}
r.tv_nsec -= ts2->tv_nsec;
r.tv_sec -= ts2->tv_sec;
*ret = r;
r.tv_nsec -= ts2->tv_nsec;
r.tv_sec -= ts2->tv_sec;
*ret = r;
}