aboutsummaryrefslogtreecommitdiffstats
path: root/cgit.h
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2007-05-22 23:08:46 +0200
committerLars Hjemli <hjemli@gmail.com>2007-05-22 23:12:41 +0200
commit5db39170b6c979655a0238dcd627e206febed88b (patch)
tree2c79691bde31f9db2861dc76010691e9dbdde1cb /cgit.h
parent3b86b44fc761cfa8b97c44bbbdd63c9fbf1127ed (diff)
Add cgit_print_age() function
This function can be used to print relative dates, just as in gitweb. Next step will be to actually use the new function. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'cgit.h')
-rw-r--r--cgit.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/cgit.h b/cgit.h
index 8927236..4da2d3d 100644
--- a/cgit.h
+++ b/cgit.h
@@ -29,6 +29,25 @@
#define CMD_BLOB 6
#define CMD_SNAPSHOT 7
+
+/*
+ * Dateformats used on misc. pages
+ */
+#define FMT_LONGDATE "%Y-%m-%d %H:%M:%S"
+#define FMT_SHORTDATE "%Y-%m-%d"
+
+
+/*
+ * Limits used for relative dates
+ */
+#define TM_MIN 60
+#define TM_HOUR (TM_MIN * 60)
+#define TM_DAY (TM_HOUR * 24)
+#define TM_WEEK (TM_DAY * 7)
+#define TM_YEAR (TM_DAY * 365)
+#define TM_MONTH (TM_YEAR / 12.0)
+
+
typedef void (*configfn)(const char *name, const char *value);
typedef void (*filepair_fn)(struct diff_filepair *pair);
typedef void (*linediff_fn)(char *line, int len);
@@ -181,7 +200,8 @@ extern char *cgit_pageurl(const char *reponame, const char *pagename,
const char *query);
extern void cgit_print_error(char *msg);
-extern void cgit_print_date(unsigned long secs);
+extern void cgit_print_date(time_t secs, char *format);
+extern void cgit_print_age(time_t t, time_t max_relative, char *format);
extern void cgit_print_docstart(char *title, struct cacheitem *item);
extern void cgit_print_docend();
extern void cgit_print_pageheader(char *title, int show_search);