diff options
Diffstat (limited to 'src/ui.c')
-rw-r--r-- | src/ui.c | 39 |
1 files changed, 35 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) |