diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2023-05-20 23:45:21 +0200 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2023-05-20 23:45:21 +0200 |
commit | bdca81b4f667bdeac2fd77b87ba19de868f7fe5e (patch) | |
tree | c9cb00616b29973b75b42d5bcb7017bf9720c5d1 /src | |
parent | 13c4a1446bd5337c0a500498803ef17a438bc6ac (diff) | |
download | cgci-bdca81b4f667bdeac2fd77b87ba19de868f7fe5e.tar.gz cgci-bdca81b4f667bdeac2fd77b87ba19de868f7fe5e.zip |
work with UTC time, add footer, darken tab color
Diffstat (limited to 'src')
-rw-r--r-- | src/ui.c | 39 | ||||
-rw-r--r-- | src/ui.h | 1 |
2 files changed, 36 insertions, 4 deletions
@@ -2,6 +2,7 @@ #include <string.h> #include <dirent.h> #include <stdlib.h> +#include <time.h> #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( + "<div class=\"footer\">" + "<table class=\"tabs\">" + "<tbody>" + "<tr>" + "<td>" + "</td>" + "</tr>" + "</tbody>" + "</table>" + "<p class=\"text\">" + "generated by cgci "VERSION" at %s" + "</p>" + "</div>", + timestr + ); +} + void print_asset(const char* file) { if (!file) @@ -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*); |