aboutsummaryrefslogtreecommitdiff
path: root/google
diff options
context:
space:
mode:
authorgleeper <31918270+gleeper@users.noreply.github.com>2019-04-07 21:44:08 -0400
committerChristopher Wilcox <crwilcox@google.com>2019-04-07 18:44:08 -0700
commitca8822b19be3247a99e7b50494b0f6adfa8132d8 (patch)
tree7cf0e7f8e9c19558bb8cbe60209ffc5d7f333ea1 /google
parente6eb1c55805db6151771ec7f2312490da17b636f (diff)
downloadpython-api-core-ca8822b19be3247a99e7b50494b0f6adfa8132d8.tar.gz
Append leading zeros for nanosecond precision DateTimes (#7663)
Diffstat (limited to 'google')
-rw-r--r--google/api_core/datetime_helpers.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/google/api_core/datetime_helpers.py b/google/api_core/datetime_helpers.py
index b0d9105..84c1bb7 100644
--- a/google/api_core/datetime_helpers.py
+++ b/google/api_core/datetime_helpers.py
@@ -222,7 +222,7 @@ class DatetimeWithNanoseconds(datetime.datetime):
"""
if self._nanosecond == 0:
return to_rfc3339(self)
- nanos = str(self._nanosecond).rstrip("0")
+ nanos = str(self._nanosecond).rjust(9, '0').rstrip("0")
return "{}.{}Z".format(self.strftime(_RFC3339_NO_FRACTION), nanos)
@classmethod