Reading negative DWORD from registry

Hi,

Am fairly new to Automise, and am trying to read in a UTC date from an FTP site and convert it to local date.  The above registry key contains the offset, which is -60 mins, but this is being read into the automise variable as 4294967236 (0xffffffc4).

What's going to be the best way of interpreting a DWORD as a 32 bit signed int rather than as an unsigned int?

Thanks.

Hi

The DWORD data type stores an unsigned integer which cannot have a value of less than 0. When you view this value in the Registry Editor what does it contain?

Regards,
Steve

Sorry after I posted the response, it dawned on me what you meant.

To calculate the wrap-around you could do something simple like this (in VBScript). Note that I haven’t added any range checking or anything so if the value is not negative (has not wrapped around) then it will return an invalid value.

Dim value
Dim result

value = 4294967236

result = value - 2^32

Action.SendLogMessage result, stInformation

Hi, thanks for the reply. As a “workaround” I wrote the following VBScript (where TimeOffset is the variable that is set from the registry value:

if TimeOffset > (2 ^ 31) then
TimeOffset = TimeOffset - 2 ^ 32
end if

Looks like that is as good as it gets…