[Gambas-user] forcing time zone localization

Kevin Fishburne kevinfishburne at ...1887...
Fri Feb 1 08:37:04 CET 2013


On 01/31/2013 04:29 AM, Benoît Minisini wrote:
> Le 31/01/2013 08:35, Kevin Fishburne a écrit :
>> I have a client/server application in which the server tells the client
>> the date and time. The date and time is calculated by the server from an
>> arbitrary starting point and at an arbitrary scale, but based on the
>> server's system clock so that time still "advances" when the server
>> application is not running. The client and server display the date and
>> time using code like this:
>>
>> Format$(CDate(DateCurrent), "mmmm d, yyyy, hh:nn:AM/PM")
>>
>> I need Gambas to use a specific time zone for the client and server,
>> ignoring the system time zone. I've read this:
>>
>> http://gambasdoc.org/help/doc/locale?v3
>>
>> Is what I'm trying to do possible? What environment variable should I
>> set in Gambas ($LC_ALL, $LANG), and is there an ISO or table of codes to
>> choose from? I've looked at ISO 3166 here:
>>
>> http://en.wikipedia.org/wiki/ISO_3166
>>
>> Thanks.
>>
> You should not need to use a different timezone for a program. Otherwise
> you can use the TZ environmental variable.
>
> But you can get the current timezone by doing: Round(Frac(Date(now)) *
> 24). (Meaning that the time is UTC + that value. TZ is set with the
> opposite).
>
> Then you can convert a local time to GTM time for your communication
> between server and client.
>
> Dunno if it fits your need.
>
> Regards,
>

Just spent two hours on this with no success. I have the server's OS set 
to use Venezuela's time zone because it has no DST. The client OS is 
UTC/GMT -5 (US Eastern). The client and server start with the same raw 
date/time obtained through CFloat(Now) on the server. The client's 
date/time is different than the server's by 30 minutes due to 
localization used by Format$.

I created a TZ environment variable and regardless of its value it has 
no effect on the output of Format$. Is the TZ environment variable 
ignored or not used by Format$? There may be a solution staring me in 
the face based on the information you gave me, but I can't see it 
despite my efforts. The really stupid way to solve the problem would be 
to set the client and server OS time zones to be the same, but that 
would correctly inform the user that I was an idiot. ;)

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271





More information about the User mailing list