Documentation
¶
Index ¶
- Variables
- func AsSecondsDouble(t Time) float64
- func Monotonic(out *Time) error
- func MonotonicWithInfo(out *Time, info *ClockInfo) error
- func PerfCounter(out *Time) error
- func PerfCounterWithInfo(out *Time, info *ClockInfo) error
- func TimeWithInfo(out *Time, info *ClockInfo) error
- func Time_(out *Time) error
- type ClockInfo
- type Rounding
- type Time
Constants ¶
This section is empty.
Variables ¶
var ErrOverflow = errors.New("OverflowError: timestamp out of range for platform Py_TIME")
ErrOverflow matches CPython's "timestamp out of range for platform" OverflowError raised by pytime_time_t_overflow.
CPython: Python/pytime.c pytime_time_t_overflow
Functions ¶
func AsSecondsDouble ¶
AsSecondsDouble converts Time to a float-seconds value.
CPython: Include/cpython/pytime.h:14 PyTime_AsSecondsDouble
func Monotonic ¶
Monotonic writes a monotonic clock reading to *out. The reading is nanoseconds since process start; it never decreases on a single machine.
CPython: Python/pytime.c:1223 PyTime_Monotonic
func MonotonicWithInfo ¶
MonotonicWithInfo writes a monotonic reading and fills info.
CPython: Python/pytime.c:1245 _PyTime_MonotonicWithInfo
func PerfCounter ¶
PerfCounter writes a high-resolution monotonic counter to *out. On every supported platform CPython aliases this to monotonic, so we do the same.
CPython: Python/pytime.c:1266 PyTime_PerfCounterRaw
func PerfCounterWithInfo ¶
PerfCounterWithInfo writes a high-resolution monotonic counter and fills info.
CPython: Python/pytime.c:1255 _PyTime_PerfCounterWithInfo
func TimeWithInfo ¶
TimeWithInfo writes the wall-clock time and fills info.
CPython: Python/pytime.c:1031 _PyTime_TimeWithInfo
Types ¶
type ClockInfo ¶
ClockInfo mirrors _Py_clock_info_t. time.get_clock_info() returns a named tuple with these four fields.
CPython: Include/internal/pycore_time.h _Py_clock_info_t
type Rounding ¶
type Rounding int
Rounding selects the float-to-int conversion strategy used by FromSeconds and friends.
CPython: Include/internal/pycore_time.h:69 _PyTime_round_t
type Time ¶
type Time int64
Time is the gopy equivalent of PyTime_t. The epoch depends on the clock that produced the value: Monotonic returns nanoseconds since process start, Time_ returns nanoseconds since the Unix epoch.
CPython: Include/cpython/pytime.h:10 typedef int64_t PyTime_t
MinTime and MaxTime mirror PyTime_MIN / PyTime_MAX.
CPython: Include/cpython/pytime.h:11 PyTime_MIN
func Deadline ¶
Deadline returns Monotonic() + timeout, the absolute time at which a timeout-bounded wait should give up.
CPython: Python/pytime.c _PyDeadline_Init
func FromNanoseconds ¶
FromNanoseconds wraps an int64 ns count as Time.
func FromSeconds ¶
FromSeconds converts a float-seconds value to a Time using the given rounding. Returns ErrOverflow if the value falls outside the int64 ns range; returns a ValueError-shaped error on NaN.
CPython: Python/pytime.c:626 _PyTime_FromSecondsObject (float branch)