Actions
Defect #10405
openTimeZone information lost when import from scm (utc timezone for server)
Status:
New
Priority:
Normal
Assignee:
-
Category:
SCM
Target version:
-
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Affected version:
Description
Good day, community
ReproduceI 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
- I commit my revision 5755 in issue 1379 at 8.3.2012 00.38 UTC (local time - 8.3.2012 11.38 UTC+11)
- Right after that, in issue 1379 view, I see revision time: 8.3.2012 21.38 (view user profile time - UTC+10)
- Even if I logged as another user (view user profile - UTC) I see revision time: 8.3.2012 11.38am
- Revision time must be 8.3.2012 11.38 in my local time or 8.3.2012 00.38 in UTC
I think it happend when using Time instead Time.zone to write values to ActiveRecord.datetime fields.
I've check:
- svnlook info -r 5757 /var/svn gives me right time -
2012-03-08 11:38:01 +1100
- 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 Time.zone, even in 1.3.1, see: svn adapter, line 190
In this case, Time.zone.parse 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) Time.zone = "UTC" date = date.in_time_zone if date.respond_to?(:in_time_zone) self.commit_date = date super end
It solve problem in my turn, but one problem that Time.zone UTC hardcoded used, anyone suppose better solution? I've found, that another issues related to this:
Information:
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
No data to display
Actions