Movatterモバイル変換


[0]ホーム

URL:


mono

package
v1.92.2Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License:BSD-3-ClauseImports:3Imported by:12

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package mono provides fast monotonic time.On most platforms, mono.Now is about 2x faster than time.Now.However, time.Now is really fast, and nicer to use.

For almost all purposes, you should use time.Now.

Package mono exists because we get the current time multipletimes per network packet, at which point it makes ameasurable difference.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcSince

func Since(tTime)time.Duration

Since returns the time elapsed since t.

Types

typeTime

type Timeint64

Time is the number of nanoseconds elapsed since an unspecified reference start time.

funcNow

func Now()Time

Now returns the current monotonic time.

func (Time)Add

func (tTime) Add(dtime.Duration)Time

Add returns t+d.

func (Time)After

func (tTime) After(nTime)bool

After reports t > n, whether t is after n.

func (Time)Before

func (tTime) Before(nTime)bool

Before reports t < n, whether t is before n.

func (Time)IsZero

func (tTime) IsZero()bool

IsZero reports whether t == 0.

func (*Time)LoadAtomic

func (t *Time) LoadAtomic()Time

LoadAtomic does an atomic load *t.

func (Time)MarshalJSON

func (tTime) MarshalJSON() ([]byte,error)

MarshalJSON formats t for JSON as if it were a time.Time.We format Time this way for backwards-compatibility.Time does not survive a MarshalJSON/UnmarshalJSON round trip unchangedacross different invocations of the Go process. This is best-effort only.Since t is a monotonic time, it can vary from the actual wall clock by arbitrary amounts.Even in the best of circumstances, it may vary by a few milliseconds.

func (*Time)StoreAtomic

func (t *Time) StoreAtomic(newTime)

StoreAtomic does an atomic store *t = new.

func (Time)String

func (tTime) String()string

String prints t, including an estimated equivalent wall clock.This is best-effort only, for rough debugging purposes only.Since t is a monotonic time, it can vary from the actual wall clock by arbitrary amounts.Even in the best of circumstances, it may vary by a few milliseconds.

func (Time)Sub

func (tTime) Sub(nTime)time.Duration

Sub returns t-n, the duration from n to t.

func (*Time)UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte)error

UnmarshalJSON sets t according to data.Time does not survive a MarshalJSON/UnmarshalJSON round trip unchangedacross different invocations of the Go process. This is best-effort only.

func (Time)WallTime

func (tTime) WallTime()time.Time

WallTime returns an approximate wall time that corresponded to t.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp