From c7b9f59815ab3f9d57f690cb63631060823a3125 Mon Sep 17 00:00:00 2001 From: Bob Beck Date: Tue, 7 Oct 2025 10:39:06 -0600 Subject: [PATCH] fix format nits --- crypto/asn1/a_time_posix.c | 6 ++--- include/openssl/posix_time.h | 44 +++++++++++++++++------------------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/crypto/asn1/a_time_posix.c b/crypto/asn1/a_time_posix.c index ccef3ae9c8..51278e73db 100644 --- a/crypto/asn1/a_time_posix.c +++ b/crypto/asn1/a_time_posix.c @@ -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; diff --git a/include/openssl/posix_time.h b/include/openssl/posix_time.h index 43ca29cfc6..46f5d56a22 100644 --- a/include/openssl/posix_time.h +++ b/include/openssl/posix_time.h @@ -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 */