summaryrefslogtreecommitdiff
path: root/src/util/date.h
blob: 7ebd3c30e41ffa3f3a053807511b1b2da8527217 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 * Copyright (C) the libgit2 contributors. All rights reserved.
 *
 * This file is part of libgit2, distributed under the GNU GPL v2 with
 * a Linking Exception. For full terms see the included COPYING file.
 */
#ifndef INCLUDE_date_h__
#define INCLUDE_date_h__

#include "util.h"
#include "str.h"

/*
 * Parse a string into a value as a git_time_t.
 *
 * Sample valid input:
 * - "yesterday"
 * - "July 17, 2003"
 * - "2003-7-17 08:23"
 */
extern int git_date_parse(git_time_t *out, const char *date);

/*
 * Format a git_time as a RFC2822 string
 *
 * @param out buffer to store formatted date
 * @param time the time to be formatted
 * @param offset the timezone offset
 * @return 0 if successful; -1 on error
 */
extern int git_date_rfc2822_fmt(git_str *out, git_time_t time, int offset);

#endif