From 57ea1aa2a5eab7f6aba702b3366fe4dcc72124f6 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Tue, 19 Jan 2016 19:33:01 +0000 Subject: ui-shared: remove "format" from cgit_print_age() We never use any format other than FMT_SHORTDATE, so move that into the function. Signed-off-by: John Keeping --- ui-shared.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui-shared.h') diff --git a/ui-shared.h b/ui-shared.h index de08e1b..c9413ed 100644 --- a/ui-shared.h +++ b/ui-shared.h @@ -62,7 +62,7 @@ extern void cgit_print_error(const char *fmt, ...); __attribute__((format (printf,1,0))) extern void cgit_vprint_error(const char *fmt, va_list ap); extern void cgit_print_date(time_t secs, const char *format, int local_time); -extern void cgit_print_age(time_t t, time_t max_relative, const char *format); +extern void cgit_print_age(time_t t, time_t max_relative); extern void cgit_print_http_headers(void); extern void cgit_redirect(const char *url, bool permanent); extern void cgit_print_docstart(void); -- cgit v1.1 From 360af46fac6fe79ec1868141a6c34b4c6b732ba0 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Tue, 19 Jan 2016 19:33:03 +0000 Subject: ui-shared: add cgit_date_mode() This returns the correct mode value for use with Git's show_date() based on the current CGit configuration and will be used in the following patches. Signed-off-by: John Keeping --- ui-shared.h | 1 + 1 file changed, 1 insertion(+) (limited to 'ui-shared.h') diff --git a/ui-shared.h b/ui-shared.h index c9413ed..707cec9 100644 --- a/ui-shared.h +++ b/ui-shared.h @@ -61,6 +61,7 @@ __attribute__((format (printf,1,2))) extern void cgit_print_error(const char *fmt, ...); __attribute__((format (printf,1,0))) extern void cgit_vprint_error(const char *fmt, va_list ap); +extern const struct date_mode *cgit_date_mode(const char *format); extern void cgit_print_date(time_t secs, const char *format, int local_time); extern void cgit_print_age(time_t t, time_t max_relative); extern void cgit_print_http_headers(void); -- cgit v1.1 From f2a901d2e1db5217d6890b26c6dc1ec119505d02 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Tue, 19 Jan 2016 19:33:05 +0000 Subject: ui: show ages in the originator's timezone This affects the tooltip showing the full time and the case when a date is sufficiently old to be shown in full rather than as an offset. Signed-off-by: John Keeping --- ui-shared.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui-shared.h') diff --git a/ui-shared.h b/ui-shared.h index 707cec9..e42f13a 100644 --- a/ui-shared.h +++ b/ui-shared.h @@ -63,7 +63,7 @@ __attribute__((format (printf,1,0))) extern void cgit_vprint_error(const char *fmt, va_list ap); extern const struct date_mode *cgit_date_mode(const char *format); extern void cgit_print_date(time_t secs, const char *format, int local_time); -extern void cgit_print_age(time_t t, time_t max_relative); +extern void cgit_print_age(time_t t, int tz, time_t max_relative); extern void cgit_print_http_headers(void); extern void cgit_redirect(const char *url, bool permanent); extern void cgit_print_docstart(void); -- cgit v1.1 From 17c74eefa4390d42a244b12885dc63ac4a764e44 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Tue, 19 Jan 2016 19:33:08 +0000 Subject: ui-shared: remove cgit_print_date() There are no longer any users of this function. Signed-off-by: John Keeping --- ui-shared.h | 1 - 1 file changed, 1 deletion(-) (limited to 'ui-shared.h') diff --git a/ui-shared.h b/ui-shared.h index e42f13a..43789de 100644 --- a/ui-shared.h +++ b/ui-shared.h @@ -62,7 +62,6 @@ extern void cgit_print_error(const char *fmt, ...); __attribute__((format (printf,1,0))) extern void cgit_vprint_error(const char *fmt, va_list ap); extern const struct date_mode *cgit_date_mode(const char *format); -extern void cgit_print_date(time_t secs, const char *format, int local_time); extern void cgit_print_age(time_t t, int tz, time_t max_relative); extern void cgit_print_http_headers(void); extern void cgit_redirect(const char *url, bool permanent); -- cgit v1.1 From 9c15f3c6954e43c5ffd36230e666eccf112803f2 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Mon, 8 Feb 2016 15:05:54 +0000 Subject: Avoid DATE_STRFTIME for long/short dates Git's DATE_STRFTIME ignores the timezone argument and just uses the local timezone regardless of whether the "local" flag is set. Since our existing FMT_LONGDATE and FMT_SHORTDATE are pretty-much perfect matches to DATE_ISO8601 and DATE_SHORT, switch to taking a date_mode_type directly in cgit_date_mode(). Signed-off-by: John Keeping --- ui-shared.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui-shared.h') diff --git a/ui-shared.h b/ui-shared.h index 43789de..b457c97 100644 --- a/ui-shared.h +++ b/ui-shared.h @@ -61,7 +61,7 @@ __attribute__((format (printf,1,2))) extern void cgit_print_error(const char *fmt, ...); __attribute__((format (printf,1,0))) extern void cgit_vprint_error(const char *fmt, va_list ap); -extern const struct date_mode *cgit_date_mode(const char *format); +extern const struct date_mode *cgit_date_mode(enum date_mode_type type); extern void cgit_print_age(time_t t, int tz, time_t max_relative); extern void cgit_print_http_headers(void); extern void cgit_redirect(const char *url, bool permanent); -- cgit v1.1