Bug 487865: Exporting bugs in XML format uses non-unique timezones (they cannot be imported back) - Patch by Frédéric Buclin <LpSolit@gmail.com> r=ghendricks a=LpSolit

git-svn-id: svn://10.0.0.236/trunk@256886 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
lpsolit%gmail.com 2009-04-10 22:09:40 +00:00
parent f6b93b2cf8
commit 0b09463f19
2 changed files with 10 additions and 3 deletions

View File

@ -426,6 +426,13 @@ sub format_time {
# strptime($date) returns an empty array if $date has an invalid date format.
my @time = strptime($date);
unless (scalar @time) {
# If an unknown timezone is passed (such as MSK, for Moskow), strptime() is
# unable to parse the date. We try again, but we first remove the timezone.
$date =~ s/\s+\S+$//;
@time = strptime($date);
}
if (scalar @time) {
# Fix a bug in strptime() where seconds can be undefined in some cases.
$time[0] ||= 0;

View File

@ -79,7 +79,7 @@
[% NEXT IF c.isprivate && !user.in_group(Param("insidergroup")) %]
<long_desc isprivate="[% c.isprivate FILTER xml %]">
<who name="[% c.author.name FILTER xml %]">[% c.author.email FILTER email FILTER xml %]</who>
<bug_when>[% c.time FILTER time FILTER xml %]</bug_when>
<bug_when>[% c.time FILTER time("%Y-%m-%d %T %z") FILTER xml %]</bug_when>
[% IF user.in_group(Param('timetrackinggroup')) && (c.work_time - 0 != 0) %]
<work_time>[% PROCESS formattimeunit time_unit = c.work_time FILTER xml %]</work_time>
[% END %]
@ -97,7 +97,7 @@
isprivate="[% a.isprivate FILTER xml %]"
>
<attachid>[% a.id %]</attachid>
<date>[% a.attached FILTER time FILTER xml %]</date>
<date>[% a.attached FILTER time("%Y-%m-%d %R %z") FILTER xml %]</date>
<desc>[% a.description FILTER xml %]</desc>
<filename>[% a.filename FILTER xml %]</filename>
<type>[% a.contenttype FILTER xml %]</type>
@ -146,7 +146,7 @@
[% ELSIF field == 'cc' %]
[% val = val FILTER email %]
[% ELSIF field == 'creation_ts' OR field == 'delta_ts' %]
[% val = val FILTER time %]
[% val = val FILTER time("%Y-%m-%d %T %z") %]
[% END %]
<[% field %][% IF name != '' %] name="[% name FILTER xml %]"[% END -%]>
[%- val FILTER xml %]</[% field %]>