Jump to content

getting unsigned from _Date_Time_GetTimeZoneInformation()... pleae help!


 Share

Recommended Posts

Hi, I'm using

this code:

Local $tzInfoArray = _Date_Time_GetTimeZoneInformation()

    MsgBox(0, "", $tzInfoArray[1])

In EST, I get a value of 300... which is minutes, so that is correct.

If I switch to Amsterdam Time, I get 4294967236 instead of a negative number. I really need this negative number, how can I convert this unsigned value to a signed value?

Link to comment
Share on other sites

This should work:

Functions found here: http://www.activevb.de/tipps/vb6tipps/tipp0557.html

Const $OFFSET_4 = 4294967296
Const $MAXINT_4 = 2147483647
Const $OFFSET_2 = 65536
Const $MAXINT_2 = 32767

Func UnsignedToLong($value)
    If $Value < 0 Or $Value >= $OFFSET_4 Then Return SetError( 6) ;' Overflow
    If $Value <= $MAXINT_4 Then
        Return $Value
    Else
        Return $Value - $OFFSET_4
    EndIf    
EndFunc

Func LongToUnsigned($Value)
    If $Value < 0 Then
        Return $Value + $OFFSET_4
    Else
        $LongToUnsigned = $Value
    EndIf
EndFunc


;Example: 4294967236 -> -60
MsgBox(0, '', UnsignedToLong(4294967236))

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...