Moved a bunch of time functions into UTC. Fixes bugs which we only see for 4 hours a year.

This commit is contained in:
Matt Amos 2009-03-29 01:31:04 +00:00
parent 8140c99313
commit afcb345014
12 changed files with 22 additions and 22 deletions

View file

@ -157,7 +157,7 @@ class AmfController < ApplicationController
cs.tags = cstags
cs.user_id = user.id
# smsm1 doesn't like the next two lines and thinks they need to be abstracted to the model more/better
cs.created_at = Time.now
cs.created_at = Time.now.getutc
cs.closed_at = cs.created_at + Changeset::IDLE_TIMEOUT
cs.save_with_tags!
return [0,cs.id]

View file

@ -225,7 +225,7 @@ class ApiController < ApplicationController
endtime = Time.parse(params[:end])
else
hours = (params[:hours] || '1').to_i.hours
endtime = Time.now
endtime = Time.now.getutc
starttime = endtime - hours
end

View file

@ -461,7 +461,7 @@ private
# if parameter 'open' is nill then open and closed changsets are returned
def conditions_open(open)
return open.nil? ? nil : ['closed_at >= ? and num_changes <= ?',
DateTime.now, Changeset::MAX_ELEMENTS]
Time.now.getutc, Changeset::MAX_ELEMENTS]
end
##
@ -469,7 +469,7 @@ private
# ('closed at' time has passed or changes limit is hit)
def conditions_closed(closed)
return closed.nil? ? nil : ['closed_at < ? and num_changes > ?',
DateTime.now, Changeset::MAX_ELEMENTS]
Time.now.getutc, Changeset::MAX_ELEMENTS]
end
##

View file

@ -15,7 +15,7 @@ class MessageController < ApplicationController
@message = Message.new(params[:message])
@message.to_user_id = @to_user.id
@message.from_user_id = @user.id
@message.sent_on = Time.now
@message.sent_on = Time.now.getutc
if @message.save
flash[:notice] = 'Message sent'

View file

@ -117,7 +117,7 @@ class TraceController < ApplicationController
:description => params[:trace][:description],
:public => params[:trace][:public],
:inserted => false, :user => @user,
:timestamp => Time.now})
:timestamp => Time.now.getutc})
@trace.valid?
@trace.errors.add(:gpx_file, "can't be blank")
end
@ -313,7 +313,7 @@ private
:description => description, :public => public})
@trace.inserted = false
@trace.user = @user
@trace.timestamp = Time.now
@trace.timestamp = Time.now.getutc
if @trace.save
FileUtils.mv(filename, @trace.trace_name)