diff options
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -209,6 +209,13 @@ GIT_INLINE(bool) git__isspace(int c) return (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r' || c == '\v'); } +GIT_INLINE(int) git__time_cmp(const git_time *a, const git_time *b) +{ + /* Adjust for time zones. Times are in seconds, offsets are in minutes. */ + git_time_t adjusted_a = a->time + ((b->offset - a->offset) * 60); + return (int)(adjusted_a - b->time); +} + GIT_INLINE(bool) git__iswildcard(int c) { return (c == '*' || c == '?' || c == '['); @@ -223,4 +230,14 @@ GIT_INLINE(bool) git__iswildcard(int c) */ extern int git__parse_bool(int *out, const char *value); +/* + * Parse a string into a value as a git_time_t. + * + * Sample valid input: + * - "yesterday" + * - "July 17, 2003" + * - "2003-7-17 08:23" + */ +int git__date_parse(git_time_t *out, const char *date); + #endif /* INCLUDE_util_h__ */ |