Continue removing the time module.

Convert some more struct_time instances to datetime objects.
This commit is contained in:
John "Elwin" Edwards 2012-07-26 10:14:56 -07:00
parent 72fcde0ae0
commit 4771dce2d0
2 changed files with 8 additions and 8 deletions

View file

@ -2,7 +2,6 @@
# Module for the Roguelike Gallery, using a postgres database # Module for the Roguelike Gallery, using a postgres database
import os import os
import time
import calendar import calendar
import psycopg2 import psycopg2
from datetime import datetime, tzinfo, timedelta from datetime import datetime, tzinfo, timedelta

View file

@ -55,11 +55,14 @@ def input_datetime(outf, dvals=[None, None, None, None, None, None]):
emptf = '<input type="text" size="2" maxlength="2" name="{0}">' emptf = '<input type="text" size="2" maxlength="2" name="{0}">'
sstr = '<div>Date: <select name="year">\n' sstr = '<div>Date: <select name="year">\n'
# Default to today # Default to today
now = time.gmtime() now = datetime.now(rlgall.utc)
for dindex in range(3): if dvals[0] != None:
if not dvals[dindex]: dvals[0] = now.year
dvals[dindex] = now[dindex] if dvals[1] != None:
for year in range(2010, now[0] + 1): dvals[1] = now.month
if dvals[2] != None:
dvals[2] = now.day
for year in range(2010, now.year + 1):
if year == dvals[0]: if year == dvals[0]:
sstr += soptstr.format(year, year) sstr += soptstr.format(year, year)
else: else:
@ -279,8 +282,6 @@ if not isnotsearch:
dosearch = formname != None and dungeon != None and searchtime != None dosearch = formname != None and dungeon != None and searchtime != None
# Find the actual files, and put them in a list called gamefiles. # Find the actual files, and put them in a list called gamefiles.
gtimes = [0, int(time.time())]
relgame = None
gamefiles = [] gamefiles = []
if dosearch: if dosearch:
query1 = "SELECT ttyrecs FROM {0} WHERE name = %s AND startt <= %s AND endt >= %s;".format(dungeon.uname) query1 = "SELECT ttyrecs FROM {0} WHERE name = %s AND startt <= %s AND endt >= %s;".format(dungeon.uname)