From: Tom Hughes Date: Fri, 1 Dec 2017 19:21:42 +0000 (+0000) Subject: Make the AMF getway_old call parse times as UTC X-Git-Tag: live~3309 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/fe2e215d146439b4b837d9cc97ac3ac1a4cb8fe2?hp=1045b405ae724945b882404df45d973d6ea777a6 Make the AMF getway_old call parse times as UTC Although it's not entirely clear how to interpret a timestamp from a client the production servers have effectively been parsing them as UTC because they run in the UTC time zone all year. Using Time.zone to do the parse forces it to happen in the rails time zone rather than the system time zone, which defaults to UTC as well. Fixes #1688 --- diff --git a/app/controllers/amf_controller.rb b/app/controllers/amf_controller.rb index 5181280d9..4c24a1cec 100644 --- a/app/controllers/amf_controller.rb +++ b/app/controllers/amf_controller.rb @@ -375,7 +375,7 @@ class AmfController < ApplicationController else begin # revert - timestamp = Time.strptime(timestamp.to_s, "%d %b %Y, %H:%M:%S") + timestamp = Time.zone.strptime(timestamp.to_s, "%d %b %Y, %H:%M:%S") old_way = OldWay.where("way_id = ? AND timestamp <= ?", id, timestamp).unredacted.order("timestamp DESC").first unless old_way.nil? if old_way.visible