summaryrefslogtreecommitdiff
path: root/src/util/date.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/date.h')
-rw-r--r--src/util/date.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/util/date.h b/src/util/date.h
new file mode 100644
index 000000000..7ebd3c30e
--- /dev/null
+++ b/src/util/date.h
@@ -0,0 +1,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