On Mon, Jan 02, 2006 at 10:30:51PM +0100, Eduard Bloch wrote:
> tags 327356 + wontfix
> severity 327356 wishlist
> thanks
> 
> #include <hallo.h>
> * Harri Haataja [Fri, Sep 09 2005, 04:01:29PM]:
> 
> > /usr/share/apt-cacher/apt-cacher-report.pl has a hardcoded line for the
> > "Report generated" row. This leads to wrong/ugly date format on the
> > page (unless it's what you happen to want).
> > 
> > Could this be made locale sensitive?
> 
> a) it is not really hardcoded (by me), it is system default date
> representation, and it is IMO not that hard to understand.

<tr bgcolor=\"#cccccc\"><td bgcolor=\"#ccccff\"> Report generated
</td><td> $hour:$minute:$second $day/$month/$year </td></tr>

You're saying this is not hardcoded? Every bloody slash?

> b) AFAICS the locale system does not provide me anything to simply
> format a date into the "natural" format of some country. So unless you
> provide good reliable code I won't do anything about that (and please no
> patches with stuff like if($ENV{LC_CTIME} eq "fr_FR") ... more hardcoded
> things ... ).

The locale system is ugly, certainly, but at least there is the ISO 8601.

I don't do perl, but here's something (draws in POSIX, but didn't find a neater
way without date modules):

diff -ruN /usr/share/apt-cacher/apt-cacher-report.pl.old 
/usr/share/apt-cacher/apt-cacher-report.pl
--- /usr/share/apt-cacher/apt-cacher-report.pl.old      2006-01-04 
10:01:09.356998227 +0200
+++ /usr/share/apt-cacher/apt-cacher-report.pl  2006-01-04 10:02:00.541997023 
+0200
@@ -6,6 +6,8 @@
 # Copyright (C) 2002,2004 Jonathan Oxer <[EMAIL PROTECTED]>
 # Distributed under the terms of the GNU Public Licence (GPL).

+use POSIX qw(strftime);
+
 #use strict;
 #############################################################################
 ### configuration ###########################################################
@@ -64,11 +66,12 @@
        close(LOGFILE);
 }

-#read current time
-($second,$minute,$hour,$day,$month,$year,$null,$null,$null)=localtime(time);
+# read current time
+#($second,$minute,$hour,$day,$month,$year,$null,$null,$null)=localtime(time);
+my $datetime = strftime("%Y-%m-%d %H:%M:%S", localtime());

-$year = $year + 1900;
-$month=$month + 1;
+#$year = $year + 1900;
+#$month=$month + 1;

 my $hit_count = 0;
 my $hit_bytes = 0;
@@ -202,7 +205,7 @@
 $output .= "<h2 align=\"center\">summary</h2>
 <table border=0 cellpadding=3 cellspacing=1 bgcolor=\"#000000\" 
align=\"center\" width=\"600\">
 <tr bgcolor=\"#9999cc\"><th bgcolor=\"#9999cc\"> Item </th><th> Value 
</th></tr>
-<tr bgcolor=\"#cccccc\"><td bgcolor=\"#ccccff\"> Report generated </td><td> 
$hour:$minute:$second $day/$month/$year </td></tr>
+<tr bgcolor=\"#cccccc\"><td bgcolor=\"#ccccff\"> Report generated </td><td> 
$datetime </td></tr>
 <tr bgcolor=\"#cccccc\"><td bgcolor=\"#ccccff\"> Administrator </td><td> <a 
href=\"mailto:$config{admin_email}\";>$config{admin_email}</a> </td></tr>";
 $output .= "<tr bgcolor=\"#cccccc\"><td bgcolor=\"#ccccff\"> First request 
</td><td> $firstrecord </td></tr>";
 $output .= "<tr bgcolor=\"#cccccc\"><td bgcolor=\"#ccccff\"> Last request 
</td><td> $lastrecord </td></tr>";

-- 
Oh, my God! ARTHUR, I HAVE POCKETS!


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to