From 145310e20e1a80d7c3a4a76a27f1e415bea7b3ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Kesim?= Date: Tue, 27 Jun 2023 09:45:50 +0200 Subject: added birthdate parser --- src/include/taler_util.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/include/taler_util.h') diff --git a/src/include/taler_util.h b/src/include/taler_util.h index 1f3a4c706..dc30fca31 100644 --- a/src/include/taler_util.h +++ b/src/include/taler_util.h @@ -21,6 +21,7 @@ #ifndef TALER_UTIL_H #define TALER_UTIL_H +#include #define __TALER_UTIL_LIB_H_INSIDE__ #include @@ -510,6 +511,33 @@ char *strchrnul (const char *s, int c); #endif +/** + * @brief Parses a date information into days after 1970-01-01 (or 0) + * + * The input MUST be of the form + * + * 1) YYYY-MM-DD, representing a valid date + * 2) YYYY-MM-00, representing a valid month in a particular year + * 3) YYYY-00-00, representing a valid year. + * + * In the cases 2) and 3) the out parameter is set to the beginning of the + * time, f.e. 1950-00-00 == 1950-01-01 and 1888-03-00 == 1888-03-01 + * + * The output will set to the number of days after 1970-01-01 or 0, if the input + * represents a date belonging to the largest allowed age group. + * + * @param in Input string representation of the date + * @param mask Age mask + * @param[out] out Where to write the result + * @return GNUNET_OK on success, GNUNET_SYSERR otherwise + */ +enum GNUNET_GenericReturnValue +TALER_parse_coarse_date ( + const char *in, + const struct TALER_AgeMask *mask, + uint32_t *out); + + /** * @brief Parses a string as a list of age groups. * -- cgit v1.2.3