latency

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2020 License: MIT Imports: 1 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Simple calc latency library

Summary

  • Very simple
  • Written on tiny Go
  • Require Go version >= 1.8
  • No external dependencies

Install

go get github.com/wmentor/latency

Usage

package main

import (
  "fmt"
  "time"

  "github.com/wmentor/latency"  
)

func main() {

  l := latency.New()

  time.Sleep(time.Millisecond * 10)

  fmt.Printf("latency=%.3f\n", l.Seconds()) // like 0.01...

  time.Sleep(time.Millisecond * 160)

  fmt.Printf("latency=%.3f\n", l.Seconds()) // like 0.17...

  l.Duration() // time.Duration
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Latency

type Latency int64

func New

func New() Latency

func (Latency) Duration

func (l Latency) Duration() time.Duration

func (Latency) Seconds

func (l Latency) Seconds() float64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址