Run clang-format and enable CI check for it (#755)

* pre-commit: Update and enable clang-format check

There is newer version from clang-format so use that. We do not yet want
18 as that is little bit too new.

* Format some thing by hand which clang-format "breaks"

Clang-format will format some things little bit off in some cases.
Format some things by hand so we get cleaner end result.

* Run clang-format with

```
pre-commit run --all-files clang-format
```

We have already in previously checked places where clang-format does not
make good format and ignored those (hopefully most of the things).

---------

Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
Kari Argillander
2024-08-30 19:20:58 +03:00
committed by GitHub
parent 622a9e609e
commit f806c5829b
547 changed files with 18286 additions and 16575 deletions
+10 -7
View File
@@ -118,7 +118,8 @@ void datetime_timesync(BACNET_DATE *bdate, BACNET_TIME *btime, bool utc)
* @param true if DST is enabled and active
* @return true if local time was retrieved
*/
bool datetime_local(BACNET_DATE *bdate,
bool datetime_local(
BACNET_DATE *bdate,
BACNET_TIME *btime,
int16_t *utc_offset_minutes,
bool *dst_active)
@@ -152,15 +153,17 @@ bool datetime_local(BACNET_DATE *bdate,
* int tm_yday Day of year [0,365].
* int tm_isdst Daylight Savings flag.
*/
datetime_set_date(bdate, (uint16_t)tblock->tm_year + 1900,
datetime_set_date(
bdate, (uint16_t)tblock->tm_year + 1900,
(uint8_t)tblock->tm_mon + 1, (uint8_t)tblock->tm_mday);
#if !defined(_MSC_VER)
datetime_set_time(btime, (uint8_t)tblock->tm_hour,
(uint8_t)tblock->tm_min, (uint8_t)tblock->tm_sec,
(uint8_t)(tv.tv_usec / 10000));
datetime_set_time(
btime, (uint8_t)tblock->tm_hour, (uint8_t)tblock->tm_min,
(uint8_t)tblock->tm_sec, (uint8_t)(tv.tv_usec / 10000));
#else
datetime_set_time(btime, (uint8_t)tblock->tm_hour,
(uint8_t)tblock->tm_min, (uint8_t)tblock->tm_sec, 0);
datetime_set_time(
btime, (uint8_t)tblock->tm_hour, (uint8_t)tblock->tm_min,
(uint8_t)tblock->tm_sec, 0);
#endif
if (dst_active) {
/* The value of tm_isdst is: