aboutsummaryrefslogtreecommitdiff
path: root/src/include/taler_util.h
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2023-06-27 09:45:50 +0200
committerÖzgür Kesim <oec-taler@kesim.org>2023-06-27 09:45:50 +0200
commit145310e20e1a80d7c3a4a76a27f1e415bea7b3ce (patch)
tree0ab96ce9160504ce2df2171f3a4cb9a2de068339 /src/include/taler_util.h
parentddd0e0af136f694db6013abd0344f20c1931bad9 (diff)
downloadexchange-145310e20e1a80d7c3a4a76a27f1e415bea7b3ce.tar.xz
added birthdate parser
Diffstat (limited to 'src/include/taler_util.h')
-rw-r--r--src/include/taler_util.h28
1 files changed, 28 insertions, 0 deletions
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 <gnunet/gnunet_common.h>
#define __TALER_UTIL_LIB_H_INSIDE__
#include <gnunet/gnunet_util_lib.h>
@@ -511,6 +512,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.
*
* The string must consist of a colon-separated list of increasing integers