On 12/30/01 2:49 AM, "Jerry Hamlet" <jerry at hamletzone dot com> wrote:
> Does anyone know off hand how to determine what timezone the current machine
> your app is running on is in?
>
> _____________________________
> | Jerry Hamlet |
> | Web Designer/Programmer |
> | jerry at hamletzone dot com |
> |___________________________|
>
>
This might help you out. The following "should" return your GMT offset:
Function GetGMTOffset() As integer
#if TargetCarbon then
declare sub ReadLocation lib "CarbonLib" (location as ptr)
Inline68k("205F203C000C00E4A051")
#else
declare sub ReadLocation lib "InterfaceLib" (location as ptr)
Inline68k("205F203C000C00E4A051")
#endif
dim temp as MemoryBlock
dim gmtOffset as integer
temp = NewMemoryBlock(12)
ReadLocation temp
gmtOffset = temp.short(9)*256 + temp.byte(11)
if (gmtOffset < 0) then
gmtOffset = ceil(gmtOffset/3600)*100 + ((gmtOffset\60) mod 60)
else
gmtOffset = floor(gmtOffset/3600)*100 + ((gmtOffset\60) mod 60)
end
return gmtOffset
End Function
I haven't tested on carbon yet (just added the carbonlib declare) and I'm
not sure about Win32. Hope this helps.
--
Mike Bailey
REAL Software, Inc.
http://www.realsoftware.com
|