]> de.git.xonotic.org Git - xonotic/xonstat.git/commitdiff
Python 2.6.x doesn't have total_seconds().
authorAnt Zucaro <azucaro@gmail.com>
Sat, 25 Aug 2012 12:55:11 +0000 (08:55 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Sat, 25 Aug 2012 12:55:11 +0000 (08:55 -0400)
xonstat/batch/badges/gen_badges.py

index f631eacc1519268522a5fe4085b482107abd8213..d747c96a772809547d495bd2d17cb29620e28ed1 100644 (file)
@@ -424,7 +424,7 @@ def render_image(data):
 
 
 # environment setup
-env = bootstrap('../../../development.ini')
+env = bootstrap('../../../development.ini.home')
 req = env['request']
 req.matchdict = {'id':3}
 
@@ -437,7 +437,9 @@ players = DBSession.query(Player).\
         filter(Player.active_ind == True).\
         limit(NUM_PLAYERS).all()
 stop = datetime.now()
-print "Query took %.2f seconds" % (stop-start).total_seconds()
+td = stop-start
+total_seconds = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
+print "Query took %.2f seconds" % (total_seconds)
 
 print "Creating badges for %d players ..." % len(players)
 start = datetime.now()
@@ -448,14 +450,20 @@ for player in players:
     sstart = datetime.now()
     data = get_data(player)
     sstop = datetime.now()
-    data_time += (sstop-sstart).total_seconds()
+    td = sstop-sstart
+    total_seconds = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
+    data_time += total_seconds
 
     sstart = datetime.now()
     render_image(data)
     sstop = datetime.now()
-    render_time += (sstop-sstart).total_seconds()
+    td = sstop-sstart
+    total_seconds = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
+    render_time += total_seconds
 
 stop = datetime.now()
-print "Creating the badges took %.2f seconds (%.2f s per player)" % ((stop-start).total_seconds(), (stop-start).total_seconds()/float(len(players)))
+td = stop-start
+total_seconds = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
+print "Creating the badges took %.2f seconds (%.2f s per player)" % (total_seconds, total_seconds/float(len(players)))
 print "Total time for redering images: %.2f s" % render_time
 print "Total time for getting data: %.2f s" % data_time