This refers to the datetime module in the standard library, which Lukasz should have stated explicitly.<div><br></div><div><div>&gt;&gt;&gt; d = datetime.timedelta(500000001)</div><div>&gt;&gt;&gt; d * 2</div><div>Traceback (most recent call last):</div>
<div>  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;</div><div>OverflowError: days=1000000002; must have magnitude &lt;= 999999999</div><div><br></div><div>Lukasz:</div><div><br></div><div>You need to decide how you are handling fractional days, and it looks like you will need to manually cast to some other type </div>
<div><br></div><div>The following seems pretty safe and accounts for fractional days. If you want to account for the fractional seconds, it&#39;s a straightforward extension.</div><div><br></div><div>########</div><div>SECONDS_PER_DAY = 86400</div>
<div><br></div><div>totaldays = long(0)</div><div>totalseconds = long(0)</div><div><br></div><div>for transact in transacts:</div><div>    d_time = transact.end_time - transact.start_time</div><div>    totaldays += int(d_time.days)</div>
<div>    totalseconds += int(d_time.seconds)</div><div><br></div><div>totaldays += totalseconds/SECONDS_PER_DAY<br>#########</div><div><br></div><div>You could probably get away with just accumulating floats, but it would be a good idea to think very carefully about how that might break that if you tried it.<br>
<div class="gmail_quote"><br></div><div class="gmail_quote">mt</div><div class="gmail_quote"><br></div></div></div>