← Back to team overview

openerp-india team mailing list archive

[Bug 1078200] Re: [Trunk, 6.1] Timezone ERROR in Scheduled Actions

 

Problem occurs when the server run not in UTC zone. (System time not
UTC).

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/1078200

Title:
  [Trunk,6.1] Timezone ERROR in Scheduled Actions

Status in OpenERP Server:
  Incomplete

Bug description:
  In module BASE in file "\base\ir\ir_cron.py" function _run_job don't
  work properly.

  It take parametr "now" that calculated in local timezone like:

      now = datetime.now()

  and then compared in loop with "numbercall" that take from DB in UTC:

      while nextcall < now and numbercall:
                  ...
                  if numbercall:
                      nextcall += _intervalTypes[job['interval_type']](job['interval_number'])

  that cause "nextcall" calculated N times
  (N=TimeZoneShift/interval_number) and it make wrong interval between
  run actions.

  For example:
  ========================================================================
  current time = 09:00 (UTC)
  local current time = 13:00 (TZ = UTC+4) (current time of server)
  interval_number = 1 (from DB)
  interval_type = minutes (from DB)
  nextcall = 09:00 (from DB)
  Time to run scheduled action, that cause run function _run_job that calculate new "nextcall":

      nextcall = 09:00 + 00:01 (and repeat it 240 times)

      nextcall = 13:01

  So next run scheduled action will at 13:01 (UTC) or 17:01(local TZ). We have interval 4h and 1min, bat expect interval 1min!!!
  ========================================================================

  For correct work need

      now = datetime.now()

  change on

      now = datetime.utcnow()

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/1078200/+subscriptions


References