summaryrefslogtreecommitdiff
path: root/src/isodate
diff options
context:
space:
mode:
authorGerhard Weis <gweis@gmx.at>2010-10-29 11:32:56 +1000
committerGerhard Weis <gweis@gmx.at>2010-10-29 11:32:56 +1000
commitbc1f74552d33a3548242503bf1d40eee5b3902df (patch)
tree8d50e2571e24358ec4e5db958581ca1b3b4cf65c /src/isodate
parentfc0e0bf09d99113a8f8b9327b3a0cb6586e2a622 (diff)
downloadisodate-bc1f74552d33a3548242503bf1d40eee5b3902df.tar.gz
* Fixed problem with %P formating and fractions
Diffstat (limited to 'src/isodate')
-rw-r--r--src/isodate/isostrf.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/isodate/isostrf.py b/src/isodate/isostrf.py
index e39d7ec..6ab534b 100644
--- a/src/isodate/isostrf.py
+++ b/src/isodate/isostrf.py
@@ -151,7 +151,10 @@ def _strfduration(tdt, format, yeardigits=4):
if minutes:
ret.append('%sM' % minutes)
if seconds or usecs:
- ret.append(("%d.%06d" % (seconds, usecs)).rstrip('.0'))
+ if usecs:
+ ret.append(("%d.%06d" % (seconds, usecs)).rstrip('0'))
+ else:
+ ret.append("%d" % seconds)
ret.append('S')
# at least one component has to be there.
return ret and ''.join(ret) or '0D'