realbasic-nug
[Top] [All Lists]

Re: Cross-platform GMT offset code (was Re: Timezone)

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Cross-platform GMT offset code (was Re: Timezone)
From: Didier BARBAS <lists at sungnyemun dot org>
Date: Mon, 31 Dec 2001 15:20:13 +0530
On 12/30/2001 20:44, "Paul Scandariato" <paul_lists at intellisw dot com> wrote:
> 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
This won't take into account 'odd' offsets like New Delhi, +5:30...

-- 
Didier Barbas
Dilettante programmer and linguist



<Prev in Thread] Current Thread [Next in Thread>