Skip to content

Commit df8361e

Browse files
committed
Format
1 parent 0be84b4 commit df8361e

File tree

1 file changed

+52
-20
lines changed

1 file changed

+52
-20
lines changed

src/gnss_time.c

Lines changed: 52 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,8 @@ gps_time_t time2gps_t(const time_t t_unix) {
332332
}
333333

334334
/** Checks if GPS time t is within begin and end */
335-
bool gpstime_in_range(const gps_time_t *bgn, const gps_time_t *end,
335+
bool gpstime_in_range(const gps_time_t *bgn,
336+
const gps_time_t *end,
336337
const gps_time_t *t) {
337338
assert(bgn);
338339
assert((int)bgn->tow != TOW_UNKNOWN);
@@ -391,7 +392,8 @@ double gpsdifftime(const gps_time_t *end, const gps_time_t *beginning) {
391392
* \return True, if the time difference could be computed, false otherwise, e.g.
392393
* for end or start times with unknown week numbers.
393394
*/
394-
bool gpsdifftime_week_second(const gps_time_t *end, const gps_time_t *beginning,
395+
bool gpsdifftime_week_second(const gps_time_t *end,
396+
const gps_time_t *beginning,
395397
gps_time_duration_t *dt) {
396398
dt->seconds = 0;
397399
dt->weeks = 0;
@@ -441,8 +443,8 @@ bool gps_time_match_weeks_safe(gps_time_t *t, const gps_time_t *ref) {
441443
}
442444

443445
if (!gps_time_valid(t)) {
444-
log_info("t=(%lf,%d) ref=(%lf,%d)", t->tow, (int)t->wn, ref->tow,
445-
(int)ref->wn);
446+
log_info(
447+
"t=(%lf,%d) ref=(%lf,%d)", t->tow, (int)t->wn, ref->tow, (int)ref->wn);
446448
return false;
447449
}
448450

@@ -766,7 +768,8 @@ bool decode_utc_parameters(const u32 words[8], utc_params_t *u) {
766768
* \retval true UTC parameters have been decoded.
767769
* \retval false Decoding error.
768770
*/
769-
bool decode_utc_parameters_with_wn_ref(const u32 words[8], utc_params_t *u,
771+
bool decode_utc_parameters_with_wn_ref(const u32 words[8],
772+
utc_params_t *u,
770773
u16 wn_ref) {
771774
bool retval = false;
772775

@@ -849,7 +852,12 @@ double date2mjd(s32 year, s32 month, s32 day, s32 hour, s32 min, double sec) {
849852
*/
850853
/* NOTE: This function will be inaccurate by up to a second on the day of a leap
851854
* second. */
852-
void mjd2date(double mjd, s32 *year, s32 *month, s32 *day, s32 *hour, s32 *min,
855+
void mjd2date(double mjd,
856+
s32 *year,
857+
s32 *month,
858+
s32 *day,
859+
s32 *hour,
860+
s32 *min,
853861
double *sec) {
854862
s32 J, C, Y, M;
855863

@@ -889,8 +897,12 @@ utc_tm mjd2utc(double mjd) {
889897
* second. */
890898
double utc2mjd(const utc_tm *utc_time) {
891899
double secs = (double)utc_time->second_int + utc_time->second_frac;
892-
return date2mjd(utc_time->year, utc_time->month, utc_time->month_day,
893-
utc_time->hour, utc_time->minute, secs);
900+
return date2mjd(utc_time->year,
901+
utc_time->month,
902+
utc_time->month_day,
903+
utc_time->hour,
904+
utc_time->minute,
905+
secs);
894906
}
895907

896908
/* NOTE: This function will be inaccurate by up to a second on the week of a
@@ -900,8 +912,13 @@ utc_tm date2utc(s32 year, s32 month, s32 day, s32 hour, s32 min, double sec) {
900912
return mjd2utc(mjd);
901913
}
902914

903-
void utc2date(const utc_tm *utc_time, s32 *year, s32 *month, s32 *day,
904-
s32 *hour, s32 *min, double *sec) {
915+
void utc2date(const utc_tm *utc_time,
916+
s32 *year,
917+
s32 *month,
918+
s32 *day,
919+
s32 *hour,
920+
s32 *min,
921+
double *sec) {
905922
*year = utc_time->year;
906923
*month = utc_time->month;
907924
*day = utc_time->month_day;
@@ -951,23 +968,38 @@ double gps2mjd_params(const gps_time_t *gps_time, const utc_params_t *p) {
951968

952969
/* NOTE: This function will be inaccurate by up to a second on the week of a
953970
* leap second. */
954-
gps_time_t date2gps(s32 year, s32 month, s32 day, s32 hour, s32 min,
955-
double sec) {
971+
gps_time_t date2gps(
972+
s32 year, s32 month, s32 day, s32 hour, s32 min, double sec) {
956973
return date2gps_params(year, month, day, hour, min, sec, NULL);
957974
}
958975

959-
gps_time_t date2gps_params(s32 year, s32 month, s32 day, s32 hour, s32 min,
960-
double sec, const utc_params_t *p) {
976+
gps_time_t date2gps_params(s32 year,
977+
s32 month,
978+
s32 day,
979+
s32 hour,
980+
s32 min,
981+
double sec,
982+
const utc_params_t *p) {
961983
return mjd2gps_params(date2mjd(year, month, day, hour, min, sec), p);
962984
}
963985

964-
void gps2date(const gps_time_t *gps_time, s32 *year, s32 *month, s32 *day,
965-
s32 *hour, s32 *min, double *sec) {
986+
void gps2date(const gps_time_t *gps_time,
987+
s32 *year,
988+
s32 *month,
989+
s32 *day,
990+
s32 *hour,
991+
s32 *min,
992+
double *sec) {
966993
gps2date_params(gps_time, year, month, day, hour, min, sec, NULL);
967994
}
968995

969-
void gps2date_params(const gps_time_t *gps_time, s32 *year, s32 *month,
970-
s32 *day, s32 *hour, s32 *min, double *sec,
996+
void gps2date_params(const gps_time_t *gps_time,
997+
s32 *year,
998+
s32 *month,
999+
s32 *day,
1000+
s32 *hour,
1001+
s32 *min,
1002+
double *sec,
9711003
const utc_params_t *p) {
9721004
utc_tm utc_time;
9731005
gps2utc(gps_time, &utc_time, p);
@@ -976,8 +1008,8 @@ void gps2date_params(const gps_time_t *gps_time, s32 *year, s32 *month,
9761008

9771009
/** Return the number of days in given month */
9781010
u8 days_in_month(u16 year, u8 month) {
979-
static u8 days_in_month_lookup[13] = {0, 31, 28, 31, 30, 31, 30,
980-
31, 31, 30, 31, 30, 31};
1011+
static u8 days_in_month_lookup[13] = {
1012+
0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
9811013
if (month == 2 && is_leap_year(year)) {
9821014
return 29;
9831015
}

0 commit comments

Comments
 (0)