OTRS 4.0.10 email times incorrect

Moderator: crythias

Locked
thunter28
Znuny newbie
Posts: 34
Joined: 29 Apr 2011, 15:53
Znuny Version: 5.0.27
Real Name: Tony Hunter
Company: SecureData 365

OTRS 4.0.10 email times incorrect

Post by thunter28 »

I noticed today that when we receive email tickets from a customer the sent time is a -4 hour difference from the actual time. For example I receive a ticket today at 2:00p but the sent time from the support email read it was received at 10:00a. I saw there was a bug from 4.0.7 that addressed this, but did it get resolved in 4.0.10? If not is there a fix or workaround for this?
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: OTRS 4.0.10 email times incorrect

Post by jojo »

Yes, this is a new bug fixed in 4.0.11
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
thunter28
Znuny newbie
Posts: 34
Joined: 29 Apr 2011, 15:53
Znuny Version: 5.0.27
Real Name: Tony Hunter
Company: SecureData 365

Re: OTRS 4.0.10 email times incorrect

Post by thunter28 »

I made the upgrade to .11 this morning but noticed this did not fix the problem. Is there a setting I have to adjust for this time issue?
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: OTRS 4.0.10 email times incorrect

Post by jojo »

"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
thunter28
Znuny newbie
Posts: 34
Joined: 29 Apr 2011, 15:53
Znuny Version: 5.0.27
Real Name: Tony Hunter
Company: SecureData 365

Re: OTRS 4.0.10 email times incorrect

Post by thunter28 »

The following edit to Time.pm seemed to have fixed the issue:

Code: Select all

sub MailTimeStamp {
    my ( $Self, %Param ) = @_;

    my @DayMap   = qw/Sun Mon Tue Wed Thu Fri Sat/;
    my @MonthMap = qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/;

    # check if server is in UTC (server diff should be 0)
    my $ServerTimeDiff = Time::Local::timegm_nocheck( localtime( time() ) ) - time();

    # calculate offset - should be '+0200', '-0600', or '+0000'
    my $Diff = $Self->{TimeZone};
    if ($ServerTimeDiff) {
        $Diff = int( $ServerTimeDiff / 3600 );
    }
    my $Direction = $Diff < 0 ? '-' : '+';
    $Diff = abs $Diff;
    my $OffsetHours = $Diff;

    my ( $Sec, $Min, $Hour, $Day, $Month, $Year, $WeekDay ) = $Self->SystemTime2Date(
        SystemTime => time(),
    );

    my $TimeString = sprintf "%s, %d %s %d %02d:%02d:%02d %s%02d%02d",
        $DayMap[$WeekDay],    # 'Sat'
        $Day, $MonthMap[ $Month - 1 ], $Year,    # '2', 'Aug', '2014'
        $Hour,      $Min,         $Sec,          # '12', '34', '36'
        $Direction, $OffsetHours, 0;             # '+', '02', '00'

    return $TimeString;
}
Last edited by crythias on 05 Aug 2015, 16:11, edited 1 time in total.
Reason: [code] tags for sanity.
Locked