diff --git a/src/calibre/ebooks/metadata/opf3_test.py b/src/calibre/ebooks/metadata/opf3_test.py
index 258454dae6..8a7ce4ffe0 100644
--- a/src/calibre/ebooks/metadata/opf3_test.py
+++ b/src/calibre/ebooks/metadata/opf3_test.py
@@ -175,11 +175,13 @@ class TestOPF3(unittest.TestCase):
from calibre.utils.date import utcnow
def rl(root):
- return read_pubdate(root, read_prefixes(root), read_refines(root)), read_timestamp(root, read_prefixes(root), read_refines(root))
+ p, r = read_prefixes(root), read_refines(root)
+ return read_pubdate(root, p, r), read_timestamp(root, p, r)
def st(root, pd, ts):
- set_pubdate(root, read_prefixes(root), read_refines(root), pd)
- set_timestamp(root, read_prefixes(root), read_refines(root), ts)
+ p, r = read_prefixes(root), read_refines(root)
+ set_pubdate(root, p, r, pd)
+ set_timestamp(root, p, r, ts)
return rl(root)
def ae(root, y1=None, y2=None):
@@ -192,7 +194,8 @@ class TestOPF3(unittest.TestCase):
root = self.get_opf('''1999-3-22001''')
ae(root, 1999, 2001)
n = utcnow()
- self.ae(st(root, n, n), (n, n))
+ q = n.replace(microsecond=0)
+ self.ae(st(root, n, n), (n, q))
root = self.get_opf('''1999-3-2''')
ae(root, 1999, 2001)
root = self.get_opf('''2003''')
diff --git a/src/calibre/utils/date.py b/src/calibre/utils/date.py
index 2748a0bf01..7a33f0b865 100644
--- a/src/calibre/utils/date.py
+++ b/src/calibre/utils/date.py
@@ -199,7 +199,7 @@ def w3cdtf(date_time, assume_utc=False):
date_time = date_time.replace(tzinfo=_utc_tz if assume_utc else
_local_tz)
date_time = date_time.astimezone(_utc_tz if as_utc else _local_tz)
- return unicode(date_time.strftime('%Y-%M-%dT%H:%M:%SZ'))
+ return unicode(date_time.strftime('%Y-%m-%dT%H:%M:%SZ'))
def as_local_time(date_time, assume_utc=True):