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

clock_gettime: Add new identifier CLOCK_UPTIME_RAW for Darwin #79883

Closed
rfrail3 mannequin opened this issue Jan 10, 2019 · 6 comments
Closed

clock_gettime: Add new identifier CLOCK_UPTIME_RAW for Darwin #79883

rfrail3 mannequin opened this issue Jan 10, 2019 · 6 comments
Labels
3.8 (EOL) end of life OS-mac type-feature A feature request or enhancement

Comments

@rfrail3
Copy link
Mannequin

rfrail3 mannequin commented Jan 10, 2019

BPO 35702
Nosy @ronaldoussoren, @vstinner, @ned-deily, @tirkarthi, @nanjekyejoannah, @rfrail3
PRs
  • bpo-35702: Add new identifier CLOCK_UPTIME_RAW for Darwin #11503
  • bpo-35702: Add new identifier CLOCK_UPTIME_RAW for Darwin #11503
  • bpo-35702: Add new identifier CLOCK_UPTIME_RAW for Darwin #11503
  • 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 2019-01-10.16:58:35.670>
    created_at = <Date 2019-01-10.07:43:37.268>
    labels = ['OS-mac', 'type-feature', '3.8']
    title = 'clock_gettime: Add new identifier CLOCK_UPTIME_RAW for Darwin'
    updated_at = <Date 2019-01-10.18:01:48.090>
    user = 'https://github.com/rfrail3'

    bugs.python.org fields:

    activity = <Date 2019-01-10.18:01:48.090>
    actor = 'rfrail3'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-01-10.16:58:35.670>
    closer = 'vstinner'
    components = ['macOS']
    creation = <Date 2019-01-10.07:43:37.268>
    creator = 'rfrail3'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 35702
    keywords = ['patch', 'patch', 'patch']
    message_count = 6.0
    messages = ['333366', '333376', '333381', '333406', '333407', '333413']
    nosy_count = 6.0
    nosy_names = ['ronaldoussoren', 'vstinner', 'ned.deily', 'xtreak', 'nanjekyejoannah', 'rfrail3']
    pr_nums = ['11503', '11503', '11503']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue35702'
    versions = ['Python 3.8']

    @rfrail3
    Copy link
    Mannequin Author

    rfrail3 mannequin commented Jan 10, 2019

    Finally since the release of OSX 10.12 the equivalent from the FreeBSD and OpenBSD "CLOCK_UPTIME" is available on Darwin under the name "CLOCK_UPTIME_RAW":

    CLOCK_UPTIME FreeBSD [1]:
    Starts at zero when the kernel boots and increments monotonically in SI seconds while the machine is running.

    CLOCK_UPTIME OpenBSD [2]:
    Time whose absolute value is the time the system has been running and not suspended, providing accurate uptime measurement, both absolute and interval

    CLOCK_UPTIME_RAW Darwin [3]:
    Clock that increments monotonically, tracking the time since an arbitrary point, unaffected by frequency or time adjustments and not increment while the system is asleep.

    It would be useful to have it available on time module [4] for this platform.

    As the behaviour is equivalent, maybe it can be assigned to the existing time.CLOCK_UPTIME funtion.

    Thanks,

    [1] - https://www.freebsd.org/cgi/man.cgi?query=clock_gettime
    [2] - https://man.openbsd.org/clock_gettime.2
    [3] - http://www.manpagez.com/man/3/clock_gettime_nsec_np/
    [4] - https://docs.python.org/3/library/time.htm

    @rfrail3 rfrail3 mannequin added OS-mac type-feature A feature request or enhancement labels Jan 10, 2019
    @nanjekyejoannah
    Copy link
    Contributor

    I am working on this.

    @vstinner
    Copy link
    Member

    As the behaviour is equivalent, maybe it can be assigned to the existing time.CLOCK_UPTIME funtion.

    Nah, in Python we map directly to OS constant and don't try to be smart. It's up to the user of these constants to make their own choice.

    Use Python functions for portable behavior: time.monotonic(), time.perf_counter(), etc.

    @vstinner
    Copy link
    Member

    New changeset 572168a by Victor Stinner (Joannah Nanjekye) in branch 'master':
    bpo-35702: Add new identifier time.CLOCK_UPTIME_RAW for macOS 10.12 (GH-11503)
    572168a

    @vstinner
    Copy link
    Member

    Joannah Nanjekye added time.CLOCK_UPTIME_RAW to the master branch (future Python 3.8). We don't add feature to stable versions (like 3.7), so I close the issue.

    Thanks Ricardo Fraile for the report, I wasn't aware of this clock ;-)

    Note: Until Python 3.8 is released, you can easily hardcode the constant in your application. Such constant rarely change.

    @vstinner vstinner added the 3.8 (EOL) end of life label Jan 10, 2019
    @rfrail3
    Copy link
    Mannequin Author

    rfrail3 mannequin commented Jan 10, 2019

    Impressive response time, thanks team!

    @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.8 (EOL) end of life OS-mac type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants