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

Implementation of the PEP 564: Add time.time_ns() #75965

Closed
vstinner opened this issue Oct 13, 2017 · 4 comments
Closed

Implementation of the PEP 564: Add time.time_ns() #75965

vstinner opened this issue Oct 13, 2017 · 4 comments
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@vstinner
Copy link
Member

BPO 31784
Nosy @vstinner
PRs
  • bpo-31784: Implement PEP 564: add time.time_ns() #3989
  • bpo-31784: Use time.time_ns() in uuid.uuid1() #11189
  • [WIP] bpo-36205: incorrect time.process_time when built on macOS < 10.12 #12287
  • 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 2017-11-02.15:13:05.426>
    created_at = <Date 2017-10-13.21:34:15.734>
    labels = ['3.7', 'type-feature', 'library']
    title = 'Implementation of the PEP 564: Add time.time_ns()'
    updated_at = <Date 2019-03-12.09:39:13.861>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2019-03-12.09:39:13.861>
    actor = 'ned.deily'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-11-02.15:13:05.426>
    closer = 'vstinner'
    components = ['Library (Lib)']
    creation = <Date 2017-10-13.21:34:15.734>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31784
    keywords = ['patch']
    message_count = 4.0
    messages = ['304365', '304475', '305426', '332045']
    nosy_count = 1.0
    nosy_names = ['vstinner']
    pr_nums = ['3989', '11189', '12287']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue31784'
    versions = ['Python 3.7']

    @vstinner
    Copy link
    Member Author

    time.time() returns time as a float, but the conversion to float lose precision at the nanosecond resolution.

    I propose to add a new time.time_ns() function which returns time as an integer number of nanoseconds since epoch. It's similar to the st_mtime_ns field of os.stat_result which extended the old st_mtime field.

    For the full rationale, see my thread on python-ideas:
    [Python-ideas] Add time.time_ns(): system clock with nanosecond resolution
    https://mail.python.org/pipermail/python-ideas/2017-October/047318.html

    @vstinner vstinner added 3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Oct 13, 2017
    @vstinner vstinner changed the title Add time.time_ns(): get time with nanosecond resolution Implementation of the PEP 564: Add time.time_ns() Oct 16, 2017
    @vstinner
    Copy link
    Member Author

    For the full rationale, see my thread on python-ideas: (...)

    I just created the PEP-564: "Add new time functions with nanosecond resolution".

    @vstinner
    Copy link
    Member Author

    vstinner commented Nov 2, 2017

    New changeset c29b585 by Victor Stinner in branch 'master':
    bpo-31784: Implement PEP-564: add time.time_ns() (bpo-3989)
    c29b585

    @vstinner vstinner closed this as completed Nov 2, 2017
    @vstinner
    Copy link
    Member Author

    New changeset 62a68b7 by Victor Stinner in branch 'master':
    bpo-31784: Use time.time_ns() in uuid.uuid1() (GH-11189)
    62a68b7

    @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
    3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant