We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
from old email (from Tim Guirgies lt.infiltrator@gmail.com):
Hi Radek, The below proposed patch tells uprecords to obey the locale settings of the user's environment. I'm very new to hg, so apologies if the patch isn't quite right. diff -r 6d6bf3c205c9 src/uprecords.c --- a/src/uprecords.c Mon Feb 18 18:32:02 2013 +0100 +++ b/src/uprecords.c Thu Jul 11 13:55:42 2013 +1000 @@ -322,6 +322,12 @@ char *bold = BOLD, *plain = PLAIN, *current = ""; char *ctimec = NULL; + char *ftime = malloc(sizeof(char) * 64); + setlocale(LC_ALL, ""); + struct tm *timeinfo; + timeinfo = localtime(&btime); + strftime(ftime, 64, "%c", timeinfo); + if (runas_cgi) { bold = "<b>"; @@ -359,20 +365,20 @@ printf("<td>%s%s%s</td>\n", bold, time2uptime(utime), plain); printf("<td>%s%s%s</td>\n", bold, sys, plain); - printf("<td>%s%s%s</td>\n", bold, ctime(&btime), plain); + printf("<td>%s%s%s</td>\n", bold, ftime, plain); printf("</tr>\n"); break; case LIST: if (pos>show_max) - printf("<li>%s%s, %s, %s%s%s (position %d)", bold, time2uptime(utime), sys, ctime(&btime), plain, current, pos); + printf("<li>%s%s, %s, %s%s%s (position %d)", bold, time2uptime(utime), sys, ftime, plain, current, pos); else if (pos) - printf("<li>%s%s, %s, %s%s%s", bold, time2uptime(utime), sys, ctime(&btime), plain, current); + printf("<li>%s%s, %s, %s%s%s", bold, time2uptime(utime), sys, ftime, plain, current); else - printf("<li>%s%s %s %s %s%s", bold, ident, time2uptime(utime), sys, ctime(&btime), plain); + printf("<li>%s%s %s %s %s%s", bold, ident, time2uptime(utime), sys, ftime, plain); break; default: - if((ctimec = ctime(&btime))) + if((ctimec = ftime)) ctimec[TIMEMAX-1] = '\0'; /* erase the ending '\n' */ if (!wide_out && strlen(sys) > SYSWIDTH) sys[SYSWIDTH] = '\0'; /* truncate for 80 cols */ @@ -389,6 +395,12 @@ char *ctimec = NULL; char timebuf[20] = "", dtimebuf[20] = ""; + char *ftime = malloc(sizeof(char) * 64); + setlocale(LC_ALL, ""); + struct tm *timeinfo; + timeinfo = localtime(&btime); + strftime(ftime, 64, "%c", timeinfo); + strcpy(timebuf, time2uptime(utime)); strcpy(dtimebuf, time2uptime(dtime)); @@ -421,20 +433,20 @@ printf("<td>%s%s%s</td>\n", bold, timebuf, plain); printf("<td>%s%s%s</td>\n", bold, dtimebuf, plain); - printf("<td>%s%s%s</td>\n", bold, ctime(&btime), plain); + printf("<td>%s%s%s</td>\n", bold, ftime, plain); printf("</tr>\n"); break; case LIST: if (pos>show_max) - printf("<li>%s%s, %s, %s%s%s (position %d)", bold, timebuf, dtimebuf, ctime(&btime), plain, current, pos); + printf("<li>%s%s, %s, %s%s%s (position %d)", bold, timebuf, dtimebuf, ftime, plain, current, pos); else if (pos) - printf("<li>%s%s, %s, %s%s%s", bold, timebuf, dtimebuf, ctime(&btime), plain, current); + printf("<li>%s%s, %s, %s%s%s", bold, timebuf, dtimebuf, ftime, plain, current); else - printf("<li>%s%s %s at %s%s", bold, ident, timebuf, ctime(&btime), plain); + printf("<li>%s%s %s at %s%s", bold, ident, timebuf, ftime, plain); break; default: - if((ctimec = ctime(&btime))) + if((ctimec = ftime)) ctimec[TIMEMAX-1] = '\0'; /* erase the ending '\n' */ if (pos) { printf("%s%3s%3d%21s %s|%s %*s %*s%s\n", bold, ident, pos, timebuf, plain, bold, DOWNWIDTH, dtimebuf, DOWNTIMEMAXWIDTH, ctimec, plain); @@ -448,6 +460,12 @@ { char *ctimec = NULL, *msg = "%up"; + char *ftime = malloc(sizeof(char) * 64); + setlocale(LC_ALL, ""); + struct tm *timeinfo; + timeinfo = localtime(&since); + strftime(ftime, 64, "%c", timeinfo); + if (runas_cgi) { if (layout!=PRE) { msg = "Availability (%)"; @@ -461,15 +479,15 @@ printf("<td>%s</td>\n", msg); printf("<td>%.3f</td>\n", percent); printf("<td>since</td>\n"); - printf("<td>%s</td>\n", ctime(&since)); + printf("<td>%s</td>\n", ftime); printf("</tr>\n"); break; case LIST: - printf("<li>%s %.3f since %s", msg, percent, ctime(&since)); + printf("<li>%s %.3f since %s", msg, percent, ftime); break; default: - if (ctimec = ctime(&since)) { + if (ctimec = ftime) { ctimec[TIMEMAX-1] = '\0'; /* erase the ending '\n' */ } printf("%6s %20.3f | %-*s %*s\n", msg, percent, SYSWIDTH, "since", TIMEMAX, ctimec); diff -r 6d6bf3c205c9 src/uprecords.h --- a/src/uprecords.h Mon Feb 18 18:32:02 2013 +0100 +++ b/src/uprecords.h Thu Jul 11 13:55:42 2013 +1000 @@ -22,6 +22,7 @@ #include <time.h> #include <unistd.h> #include <ctype.h> +#include <locale.h> #include "urec.h" #include "milestone.h"
The text was updated successfully, but these errors were encountered:
No branches or pull requests
from old email (from Tim Guirgies lt.infiltrator@gmail.com):
The text was updated successfully, but these errors were encountered: