Message75913
Some examples to help the choice (using the last patch).
int
---
2L
>>> print dt2 * 2
3:08:38
>>> print dt1 - dt2 * 2
0:51:22
>>> divmod(dt1, dt2)
(2L, datetime.timedelta(0, 3082))
>>> print timedelta(0, 3082)
0:51:22
In 4 hours, you can watch the movie twice, and then your have 51 minutes left.
Operations used:
- timedelta // timedelta
- timedelta * int
- divmod(timedelta, timedelta)
float
-----
0.21258172822053367
>>> "Progress: %.1f%%" % ((dt1 / dt2) * 100.0)
'Progress: 21.3%'
>>> dt2 * 0.75
...
TypeError: unsupported operand type(s) for *: 'datetime.timedelta' and 'float'
>>> print (dt2 * 3) // 4
1:10:44.250000
If you are seen this movie since 20 minutes, you're at 21% of the total. If
you want to jump to 75%, it will be at 1:10:44.
Note: timedelta * float is not implemented yet.
Operations used:
- timedelta / timedelta
- timedelta * int and timedelta // int (because timdelta / float is
not implemented yet) |
|
Date |
User |
Action |
Args |
2008-11-15 12:36:13 | vstinner | set | recipients:
+ vstinner, jribbens, amaury.forgeotdarc, mark.dickinson, belopolsky, webograph |
2008-11-15 12:36:12 | vstinner | link | issue2706 messages |
2008-11-15 12:36:12 | vstinner | create | |
|