sub convertUTC2LocalTime { # convert the time passed to the timezone of the machine my $utc = shift; my $return; my $systime_struct; my $tz_struct; $systime_struct = pack("S8", 0, 0, 0, 0, 0, 0, 0, 0); $tz_struct = pack("Lu32PLu32PL", 0, " " x 32, $systime_struct, 0, " " x 32, $systime_struct, 0); print "$systime_struct\n"; print "$tz_struct\n"; my $GetTimeZoneInformation = new Win32::API( "kernel32", "GetTimeZoneInformation", "P", "N" ); die "Failed to import API GetTimeZoneInformation: $!" unless defined($GetTimeZoneInformation); $return = $GetTimeZoneInformation->Call($tz_struct); $bias = (unpack("Lu32PLu32PL", $tz_struct))[0]; print $bias; }