fix format nits

This commit is contained in:
Bob Beck 2025-10-07 10:39:06 -06:00
parent 2b1a830122
commit c7b9f59815
2 changed files with 24 additions and 26 deletions

View File

@ -144,16 +144,16 @@ static int utc_from_posix_time(int64_t time, int *out_year, int *out_month,
day_of_era = days - era * 146097;
year_of_era = (day_of_era - day_of_era / 1460 + day_of_era / 36524 -
day_of_era / 146096) / 365;
*out_year = (int)(year_of_era + era * 400); /* Year starts on Mar 1 */
*out_year = (int) (year_of_era + era * 400); /* Year starts on Mar 1 */
day_of_year = day_of_era - (365 * year_of_era + year_of_era / 4 -
year_of_era / 100);
month_of_year = (5 * day_of_year + 2) / 153;
*out_month = (int) (month_of_year < 10 ? month_of_year + 3 :
month_of_year - 9);
month_of_year - 9);
if (*out_month <= 2)
(*out_year)++; /* Adjust year back to Jan 1 start of year. */
*out_day = (int)(day_of_year - (153 * month_of_year + 2) / 5 + 1);
*out_day = (int) (day_of_year - (153 * month_of_year + 2) / 5 + 1);
*out_hours = (int) leftover_seconds / SECS_PER_HOUR;
leftover_seconds %= SECS_PER_HOUR;
*out_minutes = (int) leftover_seconds / 60;

View File

@ -15,31 +15,29 @@
# if defined(__cplusplus)
extern "C" {
# endif
/*
* OPENSSL_posix_to_tm converts a int64_t POSIX time value in |time|,
* which must be in the range of year 0000 to 9999, to a broken out
* time value in |tm|. It returns one on success and zero on error.
*/
int OPENSSL_posix_to_tm(int64_t time, struct tm *out_tm);
/*
* OPENSSL_posix_to_tm converts a int64_t POSIX time value in
* |time|, which must be in the range of year 0000 to 9999, to a
* broken out time value in |tm|. It returns one on success and
* zero on error.
*/
int OPENSSL_posix_to_tm(int64_t time, struct tm *out_tm);
/*
* OPENSSL_tm_to_posix converts a time value between the years 0 and
* 9999 in |tm| to a POSIX time value in |out|. One is returned on
* success, zero is returned on failure. It is a failure if |tm|
* contains out of range values.
*/
int OPENSSL_tm_to_posix(const struct tm *tm, int64_t *out);
/*
* OPENSSL_tm_to_posix converts a time value between the years 0
* and 9999 in |tm| to a POSIX time value in |out|. One is
* returned on success, zero is returned on failure. It is a
* failure if |tm| contains out of range values.
*/
int OPENSSL_tm_to_posix(const struct tm *tm, int64_t *out);
/*
* OPENSSL_timegm converts a time value between the years 0 and
* 9999 in |tm| to a time_t value in |out|. One is returned on
* success, zero is returned on failure. It is a failure if the
* converted time can not be represented in a time_t, or if the tm
* contains out of range values.
*/
int OPENSSL_timegm(const struct tm *tm, time_t *out);
/*
* OPENSSL_timegm converts a time value between the years 0 and 9999
* in |tm| to a time_t value in |out|. One is returned on success,
* zero is returned on failure. It is a failure if the converted time
* can not be represented in a time_t, or if the tm contains out of
* range values.
*/
int OPENSSL_timegm(const struct tm *tm, time_t *out);
# if defined(__cplusplus)
} /* extern C */