GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — datetime.utctimetuple() should not set tm_isdst flag to 0 · Issue #53250 · python/cpython

datetime.utctimetuple() should not set tm_isdst flag to 0 #53250

New issue
Copy link
New issue
Copy link
Closed
Closed
datetime.utctimetuple() should not set tm_isdst flag to 0#53250
Copy link
Assignees
abalkin
Labels
docsDocumentation in the Doc dirDocumentation in the Doc direasytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@abalkin
abalkin
opened on Jun 16, 2010
Issue body actions
BPO 9004
Nosy @malemburg, @abalkin, @pitrou, @merwok, @karlcow, @hobbestigrou, @pganssle
PRs
  • bpo-9004: Recommend against using utctimetuple in the docs. #10870
  • bpo-37488 : Document a warning for datetime.utcnow() and utcfromtimestamp() #15773
  • Files
  • timetuple_issue9004.patch
  • 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 = 'https://github.com/abalkin'
    closed_at = None
    created_at = <Date 2010-06-16.03:36:41.910>
    labels = ['easy', 'type-bug', 'docs']
    title = 'datetime.utctimetuple() should not set tm_isdst flag to 0'
    updated_at = <Date 2019-10-03.09:54:22.605>
    user = 'https://github.com/abalkin'

    bugs.python.org fields:

    activity = <Date 2019-10-03.09:54:22.605>
    actor = 'karlcow'
    assignee = 'belopolsky'
    closed = False
    closed_date = None
    closer = None
    components = ['Documentation']
    creation = <Date 2010-06-16.03:36:41.910>
    creator = 'belopolsky'
    dependencies = []
    files = ['46050']
    hgrepos = []
    issue_num = 9004
    keywords = ['patch', 'easy']
    message_count = 8.0
    messages = ['107906', '108278', '162633', '221894', '284072', '330963', '330969', '353837']
    nosy_count = 8.0
    nosy_names = ['lemburg', 'belopolsky', 'pitrou', 'eric.araujo', 'karlcow', 'hobbestigrou', 'p-ganssle', 'Gaurav Tatke']
    pr_nums = ['10870', '15773']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue9004'
    versions = ['Python 3.6']

    Activity

    1. abalkin commented on Jun 16, 2010

      @abalkin
      abalkin
      on Jun 16, 2010
      MemberAuthor
      More actions

      I find the following quite misleading:

      >>> from datetime import datetime
      >>> import time
      >>> time.strftime('%c %z %Z', datetime.utcnow().utctimetuple())
      'Wed Jun 16 03:26:26 2010 -0500 EST'

      As far as I can tell, the only other function that uses the tm_isdst flag is time.mktime, but it expect a timetuple containing local time, not UTC time.

    2. abalkin
      added
      extension-modulesC modules in the Modules dirC modules in the Modules dir
      on Jun 16, 2010
    3. abalkin
      self-assigned this
      on Jun 16, 2010
    4. abalkin
      added
      type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
      on Jun 16, 2010
    5. abalkin commented on Jun 21, 2010

      @abalkin
      abalkin
      on Jun 21, 2010
      MemberAuthor
      More actions

      With timezone.utc available in datetime module, users should be encouraged to use dt.astimezone(timezone.utc).timetuple() instead of dt.utctimetuple(). Note that the later will set tm_isdst to -1. This observation can be used to argue for either of two ways to resolve this issue:

      1. Since utctimetuple() is no longer necessary, and the alternative works correctly, there is no need to fix it. Just recommend the astimezone use in the docs and explain the subtle difference.

      2. Having two ways to do the same thing which have a subtle difference is not a good idea.

      I am leaning towards #1, but would like to hear from others.

    6. merwok commented on Jun 11, 2012

      @merwok
      merwok
      on Jun 11, 2012
      Member
      More actions

      Just recommend the astimezone use in the docs
      and recommend creating tz-aware instances in the first time (i.e. calling now(utc) instead of utcnow()), +1.

    7. abalkin commented on Jun 29, 2014

      @abalkin
      abalkin
      on Jun 29, 2014
      MemberAuthor
      More actions

      Reclassifying this as a doc issue.

    8. abalkin
      added
      docsDocumentation in the Doc dirDocumentation in the Doc dir
      easy
      and removed
      extension-modulesC modules in the Modules dirC modules in the Modules dir
      on Jun 29, 2014
    9. GauravTatke commented on Dec 27, 2016

      @GauravTatke
      GauravTatkemannequin
      on Dec 27, 2016
      Mannequin
      More actions

      Hi,
      I am new to python and would like to contribute. I find this issue easy so changed the documentation of datetime module. I tested it with sphinx. Attaching a patch.

      Please let me know if it is correct or needs changes.
      Appreciate it!

      Regards,
      Gaurav

    10. hobbestigrou commented on Dec 3, 2018

      @hobbestigrou
      hobbestigroumannequin
      on Dec 3, 2018
      Mannequin
      More actions

      Please can you convert your patch to a pull request on github.

    11. abalkin commented on Dec 3, 2018

      @abalkin
      abalkin
      on Dec 3, 2018
      MemberAuthor
      More actions

      I submitted Gaurav's patch as PR 10870. Please review.

    12. karlcow commented on Oct 3, 2019

      @karlcow
      karlcowmannequin
      on Oct 3, 2019
      Mannequin
      More actions

      @gaurav The pull request
      #10870
      has been closed in favor of
      #15773
      which has already been merged.

      So we can probably close here.

    13. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    14. serhiy-storchaka
      added this to Date and time issues 🕰️on May 21, 2022
    15. slateny
      closed this as completedon May 22, 2022
    16. slateny
      moved this to Done in Date and time issues 🕰️on May 22, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    • @abalkin
      abalkin

    Labels

    docsDocumentation in the Doc dirDocumentation in the Doc direasytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    • Date and time issues 🕰️
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.