From 4a77c6a0c5bdbcc3a5dae48dc73caa0fa4550430 Mon Sep 17 00:00:00 2001 From: Vo Minh Thu Date: Thu, 7 Mar 2013 13:16:37 +0100 Subject: [PATCH] [FIX] timezone: under windows os.environ["TZ"] was not affecting the server, now it does (probably because we make sure to first set the environment *then* import the time module. Works fine under Windows XP. lp bug: https://launchpad.net/bugs/1038017 fixed bzr revid: vmt@openerp.com-20130307121637-47fac72clykizlnj --- openerp/__init__.py | 11 +++++++++++ openerp/cli/server.py | 2 -- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/openerp/__init__.py b/openerp/__init__.py index 1db7b616199..02f879c4929 100644 --- a/openerp/__init__.py +++ b/openerp/__init__.py @@ -22,6 +22,17 @@ """ OpenERP core library. """ + +# Make sure the OpenERP server runs in UTC. This is especially necessary +# under Windows as under Linux it seems the real import of time is +# sufficiently deferred so that setting the TZ environment variable +# in openerp.cli.server was working. +import os +os.environ['TZ'] = 'UTC' # Set the timezone... +import time # ... *then* import time. +del os +del time + # The hard-coded super-user id (a.k.a. administrator, or root user). SUPERUSER_ID = 1 diff --git a/openerp/cli/server.py b/openerp/cli/server.py index fdde56bc912..549b6529aa5 100644 --- a/openerp/cli/server.py +++ b/openerp/cli/server.py @@ -219,8 +219,6 @@ def quit_on_signals(): sys.exit(0) def main(args): - os.environ["TZ"] = "UTC" - check_root_user() openerp.tools.config.parse_config(args)