Modify

#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)

Attachments (0)

Change History (2)

comment:1 by Jpm, on Apr 3, 2018 at 1:08:35 PM

Owner: set to Jpm
Status: newassigned

comment:2 by Jpm, on Apr 3, 2018 at 5:46:41 PM

Milestone: 3.3.15.1
Resolution: Fixed
Status: assignedclosed

Fixed by revision [12114] in version: 3.3.15.1

Modify Ticket

Action
as closed The owner will remain Jpm.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.