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

github.com/thomashabets/monotonic_clock

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/thomashabets/monotonic_clock

  • v0.0.0-20191122002454-20b16818951d
  • Source
  • Go
  • Socket score

Version published
Created
Source

monotonic_clock/README

By Thomas Habets thomas@habets.se 2010

What

Provides access to a clock that always increases at the same rate. Unlike the system time (e.g. gettimeofday()) this will never decrease.

However, if there's no monotonic clock on your system then this library will fall back to gettimeofday().

For more information see: https://blog.habets.se/2010/09/gettimeofday-should-never-be-used-to-measure-time.html

Portability

Verified to be working:

Linux clock_gettime() OpenBSD clock_gettime() Solaris clock_gettime() MacOS X mach_absolute_time()

Using monotonic_clock in a project

You can either install it like a normal shared library:

./configure
make
sudo make install

Or import it into your project as a git submodule:

cd /path/to/project
git submodule add https://github.com/ThomasHabets/monotonic_clock.git
git submodule init
git submodule update

Add to configure.ac:

  AC_CONFIG_SUBDIRS([monotonic_clock])
  AC_SEARCH_LIBS([clock_gettime], [rt])

Add to Makefile.am:

  SUBDIRS=monotonic_clock
  AM_CFLAGS=-I$(top_builddir)/monotonic_clock/include @AM_CFLAGS@
  myproghere_LDADD=$(top_builddir)/monotonic_clock/.libs/libmonotonic_clock.a

Send questions/suggestions/patches/rants/0days to synscan@googlegroups.com

FAQs

Package last updated on 22 Nov 2019

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