Forráskód Böngészése

2010-10-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

	Use RFC1123 date format in debug log of MDTM response and
	last-modified time and creation date of .torrent file printed
	using -S.
	* src/FtpNegotiationCommand.cc
	* src/RequestGroup.cc
	* src/bittorrent_helper.cc
Tatsuhiro Tsujikawa 15 éve
szülő
commit
119b9a8448
4 módosított fájl, 16 hozzáadás és 21 törlés
  1. 9 0
      ChangeLog
  2. 3 10
      src/FtpNegotiationCommand.cc
  3. 2 3
      src/RequestGroup.cc
  4. 2 8
      src/bittorrent_helper.cc

+ 9 - 0
ChangeLog

@@ -1,3 +1,12 @@
+2010-10-11  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
+
+	Use RFC1123 date format in debug log of MDTM response and
+	last-modified time and creation date of .torrent file printed
+	using -S.
+	* src/FtpNegotiationCommand.cc
+	* src/RequestGroup.cc
+	* src/bittorrent_helper.cc
+
 2010-10-11  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
 
 	Bump up version number to 1.10.4

+ 3 - 10
src/FtpNegotiationCommand.cc

@@ -335,16 +335,9 @@ bool FtpNegotiationCommand::recvMdtm()
   if(status == 213) {
     if(lastModifiedTime.good()) {
       getRequestGroup()->updateLastModifiedTime(lastModifiedTime);
-      time_t t = lastModifiedTime.getTime();
-      struct tm* tms = gmtime(&t); // returned struct is statically allocated.
-      if(tms) {
-        if(getLogger()->debug()) {
-          getLogger()->debug("MDTM result was parsed as: %s GMT", asctime(tms));
-        }
-      } else {
-        if(getLogger()->debug()) {
-          getLogger()->debug("gmtime() failed for MDTM result.");
-        }
+      if(getLogger()->debug()) {
+        getLogger()->debug("MDTM result was parsed as: %s",
+                           lastModifiedTime.toHTTPDate().c_str());
       }
     } else {
       if(getLogger()->debug()) {

+ 2 - 3
src/RequestGroup.cc

@@ -1243,9 +1243,8 @@ void RequestGroup::setURISelector(const SharedHandle<URISelector>& uriSelector)
 void RequestGroup::applyLastModifiedTimeToLocalFiles()
 {
   if(!pieceStorage_.isNull() && lastModifiedTime_.good()) {
-    time_t t = lastModifiedTime_.getTime();
-    logger_->info("Applying Last-Modified time: %s in local time zone",
-                  ctime(&t));
+    logger_->info("Applying Last-Modified time: %s",
+                  lastModifiedTime_.toHTTPDate().c_str());
     size_t n =
       pieceStorage_->getDiskAdaptor()->utime(Time(), lastModifiedTime_);
     logger_->info("Last-Modified attrs of %lu files were updated.",

+ 2 - 8
src/bittorrent_helper.cc

@@ -577,14 +577,8 @@ void print(std::ostream& o, const SharedHandle<DownloadContext>& dctx)
     o << "Comment: " << torrentAttrs->comment << "\n";
   }
   if(torrentAttrs->creationDate) {
-    struct tm* staticNowtmPtr;
-    char buf[26];
-    time_t t = torrentAttrs->creationDate;
-    if((staticNowtmPtr = localtime(&t)) != 0 &&
-       asctime_r(staticNowtmPtr, buf) != 0) {
-      // buf includes "\n"
-      o << "Creation Date: " << buf;
-    }
+    o << "Creation Date: " << Time(torrentAttrs->creationDate).toHTTPDate()
+      << std::endl;
   }
   if(!torrentAttrs->createdBy.empty()) {
     o << "Created By: " << torrentAttrs->createdBy << "\n";