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

github.com/LawnGnome/clock

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/LawnGnome/clock

  • v0.0.0-20161029224725-503a11d685bc
  • Source
  • Go
  • Socket score

Version published
Created
Source

clock

This Go package provides an extremely thin wrapper over the POSIX clock API.

If you would prefer a slightly thicker wrapper that integrates with Go's time.Time type, you may want to check out Dave Cheney's https://godoc.org/github.com/davecheney/junk/clock instead. This package is very much intended for Go code that has to integrate with non-Go code using non-realtime clocks.

At present, only Linux is supported. Adding additional platforms should be as simple as defining the available CLOCK_* constants with their values: contributions are welcome, and clock_linux.go should provide a good template to start with.

Usage

A basic example of getting the current value of the CLOCK_MONOTONIC clock:

package main

import (
	"fmt"
	"os"

	"github.com/LawnGnome/clock"
)

func main() {
	ts, err := clock.Gettime(clock.CLOCK_MONOTONIC)
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	fmt.Printf("The current monotonic time is: %d.%d\n", ts.Sec, ts.Nsec)
}

FAQs

Package last updated on 29 Oct 2016

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