comparison web/templog.py @ 264:205809a8872f

integer division
author Matt Johnston <matt@ucc.asn.au>
date Sat, 13 Jun 2015 21:56:51 +0800
parents 03e540c3ec24
children 0a1c02160e66
comparison
equal deleted inserted replaced
263:654caee52c83 264:205809a8872f
113 if xpos >= 0 and xpos < config.GRAPH_WIDTH * config.ZOOM: 113 if xpos >= 0 and xpos < config.GRAPH_WIDTH * config.ZOOM:
114 click_time = orig_start \ 114 click_time = orig_start \
115 + timedelta(minutes=(float(xpos) / (config.GRAPH_WIDTH * config.ZOOM)) * minutes) 115 + timedelta(minutes=(float(xpos) / (config.GRAPH_WIDTH * config.ZOOM)) * minutes)
116 minutes = int(minutes / ZOOM_SCALE) 116 minutes = int(minutes / ZOOM_SCALE)
117 117
118 end = click_time + timedelta(minutes=minutes/2) 118 end = click_time + timedelta(minutes=minutes//2)
119 else: 119 else:
120 # zoom out 120 # zoom out
121 minutes = int(minutes*ZOOM_SCALE) 121 minutes = int(minutes*ZOOM_SCALE)
122 end += timedelta(minutes=minutes/2) 122 end += timedelta(minutes=minutes//2)
123 123
124 if end > datetime.now(): 124 if end > datetime.now():
125 end = datetime.now() 125 end = datetime.now()
126 126
127 endstr = end.strftime(DATE_FORMAT) 127 endstr = end.strftime(DATE_FORMAT)