[PATCH] Added code to output the age as seconds instead of "0 min."

Luke San Antonio lsworkemail112 at gmail.com
Sat Sep 29 02:30:16 CEST 2012


Before this patch, the program will output the age as "0 min."
Which isn't as specific as it can be... Although this patch
doesn't do any fancy automatic crap like use javascript to update
the value realtime, it still adds a much needed feature...
---
 ui-shared.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ui-shared.c b/ui-shared.c
index 43166af..a1f9d70 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -594,6 +594,11 @@ void cgit_print_age(time_t t, time_t max_relative, const char *format)
 		return;
 	}
 
+	if (secs < TM_MIN) {
+		htmlf("<span class='age-mins'>%.0f sec.</span>",
+		      secs * 1.0);
+		return;
+	}
 	if (secs < TM_HOUR * 2) {
 		htmlf("<span class='age-mins'>%.0f min.</span>",
 		      secs * 1.0 / TM_MIN);
-- 
1.7.12-rc0





More information about the CGit mailing list