The right way to do it seems to be plataform specific.
bin/service/web_services.py:timezone_get should return the contents of '/etc/timezone'
Win32 seems to have a
import win32timezone win32timezone.GetLocalTimeZone()
that returns a tzinfo object which we could extract timezone.
Olivier Dony (OpenERP) escreveu: > Determining the local timezone accurately is apparently non trivial in Python, taking into account the duplicate DST abbreviations ('EST' exists in 3 different locations with 3 different offsets from UTC) , the random timezone names used in Windows systems, etc. > However this issue is serious and causes a lot of bugs in the client when time offsets need to be calculated (the problem is actually very frequent on Windows systems, for example on Vista/Seven the tzname (DST) returned for CET is 'Madrid, Brussels') > > A few links: > * http://regebro.wordpress.com/2007/12/18/python-and-time-zones-fighting-the-beast/ > * https://bugs.launchpad.net/zope2/+bug/142148 > * http://code.google.com/p/python-datetime-tz/source/browse/trunk/datetime_tz.py?spec=svn5&r=5#102 > >
The right way to do it seems to be plataform specific.
bin/service/ web_services. py:timezone_ get should return the contents of
'/etc/timezone'
Win32 seems to have a
import win32timezone GetLocalTimeZon e()
win32timezone.
that returns a tzinfo object which we could extract timezone.
Olivier Dony (OpenERP) escreveu: regebro. wordpress. com/2007/ 12/18/python- and-time- zones-fighting- the-beast/ /bugs.launchpad .net/zope2/ +bug/142148 code.google. com/p/python- datetime- tz/source/ browse/ trunk/datetime_ tz.py?spec= svn5&r= 5#102
> Determining the local timezone accurately is apparently non trivial in Python, taking into account the duplicate DST abbreviations ('EST' exists in 3 different locations with 3 different offsets from UTC) , the random timezone names used in Windows systems, etc.
> However this issue is serious and causes a lot of bugs in the client when time offsets need to be calculated (the problem is actually very frequent on Windows systems, for example on Vista/Seven the tzname (DST) returned for CET is 'Madrid, Brussels')
>
> A few links:
> * http://
> * https:/
> * http://
>
>