[Aptitude-svn-commit] r4293 - in branches/aptitude-0.3/aptitude: . src

Daniel Burrows dburrows at costa.debian.org
Mon Sep 26 20:44:02 UTC 2005


Author: dburrows
Date: Mon Sep 26 20:43:59 2005
New Revision: 4293

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/download.cc
Log:
Include timezones in the log file timestamps.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Mon Sep 26 20:43:59 2005
@@ -1,5 +1,10 @@
 2005-09-26  Daniel Burrows  <dburrows at debian.org>
 
+	* src/download.cc:
+
+	  Write the date stamps for aptitude logs in RFC2822 format;
+	  in particular, add timezones to them.  (Closes: #318501)
+
 	* src/generic/util/util.cc, src/generic/util/util.h:
 
 	  Add a safe wrapper for strerror_r.

Modified: branches/aptitude-0.3/aptitude/src/download.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/download.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/download.cc	Mon Sep 26 20:43:59 2005
@@ -27,6 +27,8 @@
 #include <generic/apt/apt.h>
 #include <generic/apt/config_signal.h>
 
+#include <generic/util/util.h>
+
 #include "download_manager.h"
 
 #ifdef HAVEAPTCFG_H
@@ -42,6 +44,7 @@
 #include <vscreen/vs_label.h>
 #include <vscreen/vs_multiplex.h>
 
+#include <errno.h>
 #include <signal.h>
 
 #include <apt-pkg/init.h>
@@ -203,7 +206,16 @@
     }
 
   time_t curtime=time(NULL);
-  fprintf(f, "Aptitude " VERSION ": %s\n%s\n\n", _("log report"), ctime(&curtime));
+  tm ltime;
+  string timestr;
+
+  if(localtime_r(&curtime, &ltime) != NULL)
+    timestr = sstrftime("%a, %b %e %Y %T %z", &ltime);
+  else
+    timestr = ssprintf(_("Error generating local time (%s)"),
+		       sstrerror(errno).c_str());
+
+  fprintf(f, "Aptitude " VERSION ": %s\n%s\n\n", _("log report"), timestr.c_str());
   fprintf(f, _("IMPORTANT: this log only lists intended actions; actions which fail due to\ndpkg problems may not be completed.\n\n"));
   fprintf(f, _("Will install %li packages, and remove %li packages.\n"), (*apt_cache_file)->InstCount(), (*apt_cache_file)->DelCount());
   if((*apt_cache_file)->UsrSize()>0)



More information about the Aptitude-svn-commit mailing list