summaryrefslogtreecommitdiff
path: root/swift/proxy/controllers/container.py
diff options
context:
space:
mode:
authorAlistair Coles <alistairncoles@gmail.com>2022-05-06 15:18:15 +0100
committerAlistair Coles <alistairncoles@gmail.com>2022-05-06 16:19:54 +0100
commit52254bb5ca008c2662c42120417ab3490c4339ff (patch)
tree048594b61907c675bd56a7dfb1a31b21069f1317 /swift/proxy/controllers/container.py
parent7298038ed90fe5824c250975045a6f0a3eb39d04 (diff)
downloadswift-52254bb5ca008c2662c42120417ab3490c4339ff.tar.gz
Add ceil method to utils.Timestamp
There are a few places where a last-modified value is calculated by rounding a timestamp *up* to the nearest second. This patch refactors to use a new Timestamp.ceil() method to do this rounding, along with a clarifying docstring. Change-Id: I9ef73e5183bdf21b22f5f19b8440ffef6988aec7
Diffstat (limited to 'swift/proxy/controllers/container.py')
-rw-r--r--swift/proxy/controllers/container.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/swift/proxy/controllers/container.py b/swift/proxy/controllers/container.py
index 4ac00d010..4d893b96d 100644
--- a/swift/proxy/controllers/container.py
+++ b/swift/proxy/controllers/container.py
@@ -14,7 +14,6 @@
# limitations under the License.
import json
-import math
import random
import six
@@ -170,8 +169,8 @@ class ContainerController(Controller):
# GETorHEAD_base does not, so don't set it here either
resp = Response(request=req, body=shard_range_body)
update_headers(resp, headers)
- resp.last_modified = math.ceil(
- float(headers['x-put-timestamp']))
+ resp.last_modified = Timestamp(
+ headers['x-put-timestamp']).ceil()
resp.environ['swift_x_timestamp'] = headers.get(
'x-timestamp')
resp.accept_ranges = 'bytes'