Skip to content

Time module: effect of time.timezone change #60145

Closed

Description

@terryjreedy
BPO 15941
Nosy @terryjreedy, @abalkin, @vstinner
Superseder
  • bpo-28157: Document time module constants (timezone, tzname, etc.) as deprecated.
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2016-09-15.22:58:42.764>
    created_at = <Date 2012-09-13.18:07:21.005>
    labels = ['docs']
    title = 'Time module: effect of time.timezone change'
    updated_at = <Date 2016-09-15.22:58:42.762>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2016-09-15.22:58:42.762>
    actor = 'belopolsky'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2016-09-15.22:58:42.764>
    closer = 'belopolsky'
    components = ['Documentation']
    creation = <Date 2012-09-13.18:07:21.005>
    creator = 'terry.reedy'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 15941
    keywords = []
    message_count = 6.0
    messages = ['170450', '170467', '170468', '170469', '170470', '276635']
    nosy_count = 4.0
    nosy_names = ['terry.reedy', 'belopolsky', 'vstinner', 'docs@python']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'needs patch'
    status = 'closed'
    superseder = '28157'
    type = None
    url = 'https://bugs.python.org/issue15941'
    versions = ['Python 3.3']

    Activity

    1. terryjreedy commented on Sep 13, 2012

      @terryjreedy
      MemberAuthor

      "time.timezone
      The offset of the local (non-DST) timezone, in seconds west of UTC (negative in most of Western Europe, positive in the US, zero in the UK)."

      Quite aside from bpo-9305 (UTC is not a place), this does not specify the effect of setting this attribute. It does not change the output of localtime, asctime, or ctime (on Windows). Does is affect anything else? strftime? If setting it has no effect, the doc should say so. (And then perhaps it should be made read-only in the future, as setting it expecting an effect would be a bug.)

    2. added
      docs
      on Sep 13, 2012
    3. abalkin commented on Sep 14, 2012

      @abalkin
      Member

      Isn't this a duplicate of bpo-8810?

    4. abalkin commented on Sep 14, 2012

      @abalkin
      Member

      I've read this more carefully and I now understand the issue. Indeed, setting time.timezone or time.altzone has no effect on say time.strftime('%z'). I think this should be documented and the doc should refer to time.tzset() for a proper way to change these variables.

      As for making them read only, I don't think there is a non-hackish way to make module globals read-only.

      I also believe that rather than improving these variables we should encourage people to use datetime module's new timezone features because at almost any location on Earth timezone offset is not a constant and varies over time.

    5. terryjreedy commented on Sep 14, 2012

      @terryjreedy
      MemberAuthor

      bpo-8810 and bpo-9305 seem related, if not dups.

      You are right about module vars. They are all instances of one module class with one __setattr__.

      How about "Setting this attribute has no effect. See time.TZset or even better, the datetime module." (I had not noticed .altzone)

    6. abalkin commented on Sep 14, 2012

      @abalkin
      Member

      Setting this attribute has no effect.

      Strictly speaking, setting this attribute has the effect of changing the value of this attribute. I cannot come up with a better wording at this hour, but I would say something about it being "informational" only. We should also mention that these attributes are set by time.tzset().

    7. abalkin commented on Sep 15, 2016

      @abalkin
      Member

      Closing in favor of bpo-28157.

    8. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      docs

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions