Opened 6 years ago

Closed 6 years ago

#12970 closed (duplicate)

Allow "None" for conf.TIME_ZONE to avoid calling tzset()

Reported by: philz42 Owned by: nobody
Component: Uncategorized Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by ramiro)

Django defaults (I believe) to Chicago time. It often makes sense to set the time zone explicitly, but, in many applications, the system timezone (typically handled by /etc/localtime magic) is just fine. I'd like to propose that

        if hasattr(time, 'tzset'):
            # Move the time zone info into os.environ. See ticket #2315 for why
            # we don't do this unconditionally (breaks Windows).
            os.environ['TZ'] = self.TIME_ZONE

be changed to start

if self.TIME_ZONE is not None and hasattr(time, 'tzset'):

That way, if you explicitly set TIME_ZONE to None (this could be the default or not; doesn't matter to me), the system default will get used.


Change History (2)

comment:1 Changed 6 years ago by ramiro

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Possibly a duplicate of #1480.

comment:2 Changed 6 years ago by philz42

  • Resolution set to duplicate
  • Status changed from new to closed

Closing as duplicate of #1480.

Note: See TracTickets for help on using tickets.
Back to Top