on 12/30/2001 12:55 PM, Mike Bailey <mike at realsoftware dot com> wrote:
> I haven't tested on carbon yet (just added the carbonlib declare) and I'm
> not sure about Win32. Hope this helps.
Here's the GMT offset function I use, which has been tested on Classic,
Carbon, and Win32. Watch out for e-mail text wrapping.
Function OffsetFromGMT() As Integer
dim tResult as integer
dim info as memoryBlock
dim offset as integer
#if targetMacOS then
#if targetCarbon then
Declare Sub ReadLocation Lib "CarbonLib" (info As Ptr)
#else
Declare Sub ReadLocation Lib "InterfaceLib" (info As Ptr)
Inline68k("205F203C000C00E4A051")
#endif
info = newMemoryBlock(12)
ReadLocation info
offset = info.Long(8)
offset = BitwiseAnd(offset, &hFFFFFF)
if offset > &h800000 then
offset = offset - &h1000000
end if
offset = offset \ 3600
return offset
#endif
#if targetWin32 then
Declare Function GetTimeZoneInformation Lib "kernel32.dll" (TimeZoneInfo
as Ptr) as integer
info = newMemoryBlock(172)
tResult = GetTimeZoneInformation(info)
offset = -info.long(0)\60
return offset
#endif
End Function
- Paul
--
Paul Scandariato
Intelli Innovations, Inc.
Phone: (919) 468-0340
E-mail: paul at intellisw dot com
http://www.intellisw.com/
I have never let my schooling
interfere with my education.
- Mark Twain
|