src/utils.c: Introduce parse_{time,duration}()

These helpers can be used in a fashion similar to parse_date(). In
addition to check_time(), parse_time() and parse_duration() support
short forms such as "23:" (instead of "23:00") and ":45" (instead of
"00:45").

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer
2011-10-05 09:06:18 +02:00
parent d874f7ff97
commit 0acbc06c43
2 changed files with 87 additions and 0 deletions

View File

@@ -904,6 +904,8 @@ const char *get_tempdir (void);
char *new_tempfile (const char *, int);
int parse_date (const char *, enum datefmt, int *, int *, int *,
struct date *);
int parse_time (const char *, unsigned *, unsigned *);
int parse_duration (const char *, unsigned *);
void str_toupper (char *);
void file_close (FILE *, const char *);
void psleep (unsigned);