fixed time zone stuff
This commit is contained in:
@@ -7091,7 +7091,7 @@ def workout_downloadmetar_view(request,id=0,
|
|||||||
|
|
||||||
starttimeunix = arrow.get(row.startdatetime).timestamp
|
starttimeunix = arrow.get(row.startdatetime).timestamp
|
||||||
#starttimeunix = int(mktime(startdatetime.utctimetuple()))
|
#starttimeunix = int(mktime(startdatetime.utctimetuple()))
|
||||||
avgtime = starttimeunix+avgtime
|
avgtime = starttimeunix +avgtime
|
||||||
winddata = get_metar_data(airportcode,avgtime)
|
winddata = get_metar_data(airportcode,avgtime)
|
||||||
windspeed = winddata[0]
|
windspeed = winddata[0]
|
||||||
windbearing = winddata[1]
|
windbearing = winddata[1]
|
||||||
@@ -9077,11 +9077,15 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
rankingpiece =- Workout.objects.get(id=id).rankingpiece
|
rankingpiece =- Workout.objects.get(id=id).rankingpiece
|
||||||
|
|
||||||
startdatetime = (str(date) + ' ' + str(starttime))
|
startdatetime = datetime.datetime.combine(
|
||||||
startdatetime = datetime.datetime.strptime(startdatetime,
|
date,starttime
|
||||||
"%Y-%m-%d %H:%M:%S")
|
)
|
||||||
|
|
||||||
startdatetime = startdatetime.replace(tzinfo=pytz.timezone(thetimezone))
|
startdatetime = pytz.timezone(thetimezone).localize(
|
||||||
|
startdatetime
|
||||||
|
)
|
||||||
|
|
||||||
|
print startdatetime
|
||||||
try:
|
try:
|
||||||
# aware object can be in any timezone
|
# aware object can be in any timezone
|
||||||
out = startdatetime.astimezone(pytz.utc)
|
out = startdatetime.astimezone(pytz.utc)
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ def get_metar_data(airportcode,unixtime):
|
|||||||
url += str(unixtime+3600)
|
url += str(unixtime+3600)
|
||||||
url += "&stationString="+airportcode
|
url += "&stationString="+airportcode
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
s = requests.get(url)
|
s = requests.get(url)
|
||||||
except:
|
except:
|
||||||
|
|||||||
Reference in New Issue
Block a user