From bdca81b4f667bdeac2fd77b87ba19de868f7fe5e Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Sat, 20 May 2023 23:45:21 +0200 Subject: work with UTC time, add footer, darken tab color --- src/ui.c | 39 +++++++++++++++++++++++++++++++++++---- src/ui.h | 1 + 2 files changed, 36 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ui.c b/src/ui.c index d86532e..c83304b 100644 --- a/src/ui.c +++ b/src/ui.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "config.h" #include "context.h" @@ -52,6 +53,7 @@ void print_html() print_title(); print_build_nav(); print_build_info(); + print_footer(); printf(HTML_END); } } @@ -68,6 +70,7 @@ void print_html() printf(CONTENT_TYPE_FORMAT, TEXT_HTML); printf(HTML_START); print_head(); + print_footer(); printf(HTML_END); } else @@ -78,6 +81,7 @@ void print_html() print_title(); print_build_nav(); print_build_trigger(); + print_footer(); printf(HTML_END); } } @@ -90,6 +94,7 @@ void print_html() print_title(); print_build_nav(); print_build_list(); + print_footer(); printf(HTML_END); } } @@ -101,6 +106,7 @@ void print_html() print_title(); print_project_nav(); print_project_list(); + print_footer(); printf(HTML_END); } } @@ -188,9 +194,9 @@ void print_build_info() { // YYYY-MM-DD HH:MM char time[18]; - strftime(time, sizeof(time), "%Y-%m-%d %H:%M", localtime(¤t_build->timestamp)); + strftime(time, sizeof(time), "%Y-%m-%d %H:%M", gmtime(¤t_build->timestamp)); char buildtime[18]; - strftime(buildtime, sizeof(buildtime), "%Y-%m-%d %H:%M", localtime(¤t_build->completion)); + strftime(buildtime, sizeof(buildtime), "%Y-%m-%d %H:%M", gmtime(¤t_build->completion)); char* log_lines = current_build->log + strlen(current_build->log); int line_count = 20; @@ -279,7 +285,7 @@ void print_build_list() // YYYY-MM-DD HH:MM char time[18]; - strftime(time, sizeof(time), "%Y-%m-%d %H:%M", localtime(&build->timestamp)); + strftime(time, sizeof(time), "%Y-%m-%d %H:%M", gmtime(&build->timestamp)); char buildtime[255] = ""; strdifftime(build->completion, build->timestamp, buildtime, sizeof(buildtime)); @@ -348,7 +354,7 @@ void print_project_list() { class = build_class[project->builds[0].status]; status = build_string[project->builds[0].status]; - strftime(time, sizeof(time), "%Y-%m-%d %H:%M", localtime(&project->builds[0].timestamp)); + strftime(time, sizeof(time), "%Y-%m-%d %H:%M", gmtime(&project->builds[0].timestamp)); strdifftime(project->builds[0].completion, project->builds[0].timestamp, buildtime, sizeof(buildtime)); } @@ -375,6 +381,31 @@ void print_project_list() ); } +void print_footer() +{ + const time_t cur_time = time(NULL); + + char timestr[30] = "never"; + strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S %z", gmtime(&cur_time)); + + printf( + "
" + "" + "" + "" + "" + "" + "" + "
" + "
" + "

" + "generated by cgci "VERSION" at %s" + "

" + "
", + timestr + ); +} + void print_asset(const char* file) { if (!file) diff --git a/src/ui.h b/src/ui.h index 06b559b..15e07ee 100644 --- a/src/ui.h +++ b/src/ui.h @@ -18,6 +18,7 @@ void print_build_trigger(); void print_build_list(); void print_project_nav(); void print_project_list(); +void print_footer(); void print_asset(const char*); -- cgit v1.2.3