Modify

Opened 9 years ago

Closed 7 years ago

#3265 closed Bug (Fixed)

_INetSmtpMail Bias calculation returns wrong values

Reported by: Mulder Owned by: Jpm
Milestone: 3.3.15.1 Component: Standard UDFs
Version: Other Severity: None
Keywords: _INetSmtpMail Cc:

Description

Its a very old bug ....

I always get mails dated 1h in the future.
Today i took the time to look into the problem an found out that Bias calc is faulty.

Instead of returning +0200 it does return +0100
and thats wrong for a MET timezone with DST
MET == UTC + 1h
DST == +1h


Func _INetSmtpMail($sSMTPServer, $sFr .......
old

Local $aResult = _Date_Time_GetTimeZoneInformation()
Local $iBias = -$aResult[1] / 60
Local $iBiasH = Int($iBias)
Local $iBiasM = 0
If $iBiasH <> $iBias Then $iBiasM = Abs($iBias - $iBiasH) * 60
$iBias = StringFormat(" (%+.2d%.2d)", $iBiasH, $iBiasM)

new

Local $aResult = _Date_Time_GetTimeZoneInformation()
If @error Then

TCPShutdown()
Return SetError(5, 0, 0)

EndIf
Local $iBias = $aResult[1]
If $aResult[0] = 2 Then $iBias += $aResult[7]
$iBias *= -1
Local $iBiasH = Int( $iBias / 60, 1 )
Local $iBiasM = Mod( $iBias, 60 )
$iBias = StringFormat(" (%+.2d%.2d)", $iBiasH, $iBiasM)


new error code 5
@ERROR = 5 - Cannot get time zone information

$aResult[0] does show if the system is on DST
$aResult[1] does return the local offset from UTC in min
$aResult[7] does return the DST offset (always -60)

In a MET DST system
this would be
$aResult[0] = 2
$aResult[1] = -60
$aResult[7] = -60
http://www.timeanddate.com/worldclock/austria/vienna

On New York time it will be
$aResult[0] = 2
$aResult[1] = 300
$aResult[7] = -60
http://www.timeanddate.com/worldclock/usa/new-york

If the system is not on DST
$aResult[0] = 1

Tested on Win7, XPsp3


#include "Date.au3"

Local $aResult = _Date_Time_GetTimeZoneInformation()
If @error Then

TCPShutdown()
Return SetError(5, 0, 0)

EndIf
Msgbox( 0, "fixed bias", $aResult[0] & @CRLF & $aResult[1] & @CRLF & $aResult[7] )
Local $iBias = $aResult[1]
If $aResult[0] = 2 Then $iBias += $aResult[7]
$iBias *= -1
Local $iBiasH = Int( $iBias / 60, 1 )
Local $iBiasM = Mod( $iBias, 60 )
$iBias = StringFormat(" (%+.2d%.2d)", $iBiasH, $iBiasM)

msgbox(0,"",$iBias)

Change History (2)

comment:1 Changed 7 years ago by Jpm

  • Owner set to Jpm
  • Status changed from new to assigned

comment:2 Changed 7 years ago by Jpm

  • Milestone set to 3.3.15.1
  • Resolution set to Fixed
  • Status changed from assigned to closed

Fixed by revision [12114] in version: 3.3.15.1

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.