Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clock-time

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clock-time

Provide sleep(secs)/time_s() functions

  • 1.0
  • PyPI
  • Socket score

Maintainers
1

Introduction

Provide sleep(secs) / time_s() functions. Fix overflow bugs in CPython implementation so far (v3.14.0a1).

sleep(secs)

Use clock_nanosleep() with CLOCK_MONOTONIC to sleep. So that the sleep is not affected by system date/time jumps.

On CPython 3.11+, time.sleep() <https://docs.python.org/3/library/time.html#time.sleep>_ function already use this method.

time_s()

Return time as an integer number of seconds since the epoch <https://docs.python.org/3/library/time.html#epoch>_.

Usage

Only provide source code distribution, user need to install the build toolchain. It can't be compiled on platforms without clock_nanosleep().

.. sourcecode:: python

try:
    from clock_time import sleep, time_s
except ImportError:
    from time import sleep, time_ns
    def time_s():
        return time_ns() // 1_000_000_000

sleep(secs)
t = time_s()

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc