Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

odd result for datetime.time.strftime("%s") #66517

Closed
dimaqq mannequin opened this issue Sep 1, 2014 · 2 comments
Closed

odd result for datetime.time.strftime("%s") #66517

dimaqq mannequin opened this issue Sep 1, 2014 · 2 comments
Labels
extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@dimaqq
Copy link
Mannequin

dimaqq mannequin commented Sep 1, 2014

BPO 22321
Nosy @bitdancer, @dimaqq
Superseder
  • bpo-12750: add cross-platform support for %s strftime-format code
  • 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 2014-09-01.16:13:24.914>
    created_at = <Date 2014-09-01.10:03:22.197>
    labels = ['extension-modules', 'type-bug']
    title = 'odd result for datetime.time.strftime("%s")'
    updated_at = <Date 2014-09-01.16:13:24.912>
    user = 'https://github.com/dimaqq'

    bugs.python.org fields:

    activity = <Date 2014-09-01.16:13:24.912>
    actor = 'r.david.murray'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-09-01.16:13:24.914>
    closer = 'r.david.murray'
    components = ['Extension Modules']
    creation = <Date 2014-09-01.10:03:22.197>
    creator = 'Dima.Tisnek'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 22321
    keywords = []
    message_count = 2.0
    messages = ['226224', '226231']
    nosy_count = 2.0
    nosy_names = ['r.david.murray', 'Dima.Tisnek']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '12750'
    type = 'behavior'
    url = 'https://bugs.python.org/issue22321'
    versions = ['Python 2.7', 'Python 3.4']

    @dimaqq
    Copy link
    Mannequin Author

    dimaqq mannequin commented Sep 1, 2014

    $ python2 -c 'import datetime; print datetime.time(10, 44, 11).strftime("%s")'
    -2208955189
    
    $ python3 -c 'import datetime; print (datetime.time(10, 44, 11).strftime("%s"))'
    -2208955189

    So apparently, datetime.time(...).strftime("%s") semantically "seconds since unix epoch" assumes Jan 1, 1900 for missing date part.

    However datetime module doesn't allow subtracting time objects, i.e. no assumption of date is made, where "same date" chould be reasonable.

    @dimaqq dimaqq mannequin added extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error labels Sep 1, 2014
    @bitdancer
    Copy link
    Member

    I believe this is effectively a duplicate of bpo-12750. That is, python doesn't do anything in particular with %s, it just lets the platform do what it will. bpo-12750 is about making what it does consistent and cross-platform.

    (On gentoo linux I get -1 from your examples for both python2 and python3.)

    You should any any further comments to bpo-12750.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant