ppf/log-parser: add timestamp support in generic parser
authorRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Fri, 30 Apr 2010 09:27:23 +0000 (12:27 +0300)
committerRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Fri, 30 Apr 2010 09:34:52 +0000 (12:34 +0300)
ppf/log-parser/generic/GenericStatusParser.py

index 09d3cad..5077175 100644 (file)
@@ -76,9 +76,9 @@ class GenericStatusParser:
         download_size = 0
         upload_size = 0
         eta = 0
+        timestamp = datetime.datetime(2010, 04, 30)
 
-        return (num_peers, dht, download_speed, upload_speed, 
-                download_size, upload_size, eta)
+        return (timestamp, num_peers, dht, download_speed, upload_speed, download_size, upload_size, eta)
 
     def parse_last_status_line(self, line):
         try:
@@ -98,7 +98,7 @@ class GenericStatusParser:
             return []
         return self.parse_status_line(line)
 
-    def cb_print(self, num_peers, dht,
+    def cb_print(self, timestamp, num_peers, dht,
             download_speed, upload_speed,
             download_size, upload_size,
             eta_seconds):
@@ -117,7 +117,7 @@ class GenericStatusParser:
                 if self.is_status_line(line) == False:
                     continue
 
-                (num_peers, dht, download_speed, upload_speed, download_size, upload_size, eta_seconds) = self.parse_status_line(line)
+                (timestamp, num_peers, dht, download_speed, upload_speed, download_size, upload_size, eta_seconds) = self.parse_status_line(line)
 
                 logging.debug("(%d, %d, %d kb/s, %d kb/s, %d bytes, %d bytes)" % (num_peers, dht, download_speed, upload_speed, download_size, upload_size))