Defect #10405

TimeZone information lost when import from scm (utc timezone for server)

Added by Nickolay Mischenko over 10 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:


Target version:-
Resolution: Affected version:


Good day, community

I have:
  • redmine 1.2.1 stable installed
  • svn 1.6 installed on same server
  • utc timezone for redmine set (config.active_record.default_timezone = :utc)
  • one project with associated svn repository
What I do:
  1. I commit my revision 5755 in issue 1379 at 8.3.2012 00.38 UTC (local time - 8.3.2012 11.38 UTC+11)
What I see:
  1. Right after that, in issue 1379 view, I see revision time: 8.3.2012 21.38 (view user profile time - UTC+10)
  2. Even if I logged as another user (view user profile - UTC) I see revision time: 8.3.2012 11.38am
What I suppose to see:
  1. Revision time must be 8.3.2012 11.38 in my local time or 8.3.2012 00.38 in UTC
Why it happens?
I think it happend when using Time instead to write values to ActiveRecord.datetime fields.
I've check:
  1. svnlook info -r 5757 /var/svn gives me right time - 2012-03-08 11:38:01 +1100
  2. mysql gives me real database info: changesets.committed_on = "2012-03-08 11:38:01" mean it's written wrong (server uses utc time to write, no timezone correction made)

After some investigation I found that time readed from svn readed as Time object, not, even in 1.3.1, see: svn adapter, line 190

In this case, should be used instead of Time.parse, but another scm adapters also used Time.parse, and there is more correct way to fix this error: in Changeset#committed_on=

def committed_on(date) = "UTC" 
  date = date.in_time_zone if date.respond_to?(:in_time_zone)
  self.commit_date = date

It solve problem in my turn, but one problem that UTC hardcoded used, anyone suppose better solution?

I've found, that another issues related to this:
  • #5657, seems to very like my one
  • #6145, is subset of this


Redmine 1.2.1.stable.6316 (MYSQL)
Ruby version              1.8.7 (i486-linux)
RubyGems version          1.3.6
Rack version              1.1
Rails version             2.3.11
Active Record version     2.3.11
Active Resource version   2.3.11
Action Mailer version     2.3.11
Active Support version    2.3.11
Application root          /var/www-apps/redmine
Environment               production
Database adapter          mysql
Database schema version   20110511000000

Also available in: Atom PDF