diff --git a/src/libiso8601/200_parser.h b/src/libiso8601/200_parser.h index 2e9ed75..fe1268d 100644 --- a/src/libiso8601/200_parser.h +++ b/src/libiso8601/200_parser.h @@ -7,7 +7,7 @@ -/*! \defgroup parser Parsing and validation routines. +/*! \defgroup parser Parsing, printing and validation routines. These routines are used for parsing an ISO8601 date/time string into the internal structure used to represent them, and for validating such dates/times. @@ -37,6 +37,22 @@ int iso8601_parse(const char* str, struct iso8601_date* earliest, struct iso8601 +/*! \brief Print ISO8601 date/time into string. + +\param str Pointer to buffer into which result is written. +\param amt Number of bytes in \a str. +\param date Date to print. +\param details Formatting details (may be 0). + +Formats and prints an ISO8601 date, optionally using the details in \a details. Will always return +a null-terminated result, even if that means truncating the output to fit the buffer. + +*/ +void iso8601_print(char* str, int amt, const struct iso8601_date* date, + const struct iso8601_details* details); + + + /*! \brief Validate ISO8601 date/time. \param date The date to validate. diff --git a/src/libiso8601/print.c b/src/libiso8601/200_print.c similarity index 100% rename from src/libiso8601/print.c rename to src/libiso8601/200_print.c diff --git a/src/libiso8601/400_functions.h b/src/libiso8601/400_functions.h index 9e6b327..2996eaa 100644 --- a/src/libiso8601/400_functions.h +++ b/src/libiso8601/400_functions.h @@ -5,15 +5,6 @@ * http://www.gnu.org/copyleft/gpl.html for details. */ - - -/* c_library.c */ -void iso8601_now(struct iso8601_date* date, struct iso8601_details* details); -void iso8601_from_ts(struct iso8601_date* date, const struct timespec* ts); -void iso8601_to_ts(struct timespec* ts, const struct iso8601_date* date); -void iso8601_from_time_t(struct iso8601_date* date, const time_t* t); -void iso8601_to_time_t(time_t* t, const struct iso8601_date* date); - /* calc.c */ int iso8601_isleap(int year); void iso8601_to_cal(int* year, int* month, int* day, const struct iso8601_date* date); @@ -25,10 +16,6 @@ int iso8601_from_week(struct iso8601_date* date, int year, int week, int wday); void iso8601_to_clocktime(int* hour, int* min, int* sec, const struct iso8601_date* date); int iso8601_from_clocktime(struct iso8601_date* date, int hour, int min, int sec); -/* print.c */ -void iso8601_print(char* str, int amt, const struct iso8601_date* date, - const struct iso8601_details* details); - /* manip.c */ int iso8601_lt(const struct iso8601_date* d1, const struct iso8601_date* d2); int iso8601_lte(const struct iso8601_date* d1, const struct iso8601_date* d2);