package affect

  1. Overview
  2. Docs
Streamlined and natural concurrency model for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

affect-0.0.0.tbz
sha512=b328f6696e60c489da8cc2e8fad0537ca6634a39fc0c5de5840d4f98561f110617ef79ba8285ee8427dd99908c6b3d39114973598cddc5ded91abcce3b91b9a6

doc/affect.unix/Affect_unix/Ptime/Span/index.html

Module Ptime.SpanSource

POSIX time spans.

WARNING. A POSIX time span is not equal to an SI second based time span.

POSIX time spans

Sourcetype t

The type for signed picosecond precision POSIX time spans. A value of this type represent the POSIX duration between two POSIX timestamps.

Sourceval v : (int * int64) -> t

v s is like of_d_ps s but raises Invalid_argument if s is not in the right range. Use of_d_ps to deal with untrusted input.

Sourceval zero : t

zero is the neutral element of add.

Sourceval of_d_ps : (int * int64) -> t option

of_d_ps (d, ps) is a span for the signed POSIX picosecond span d * 86_400e12 + ps. d is a signed number of POSIX days and ps a number of picoseconds in the range [0;86_399_999_999_999_999L]. None is returned if ps is not in the right range.

Sourceval to_d_ps : t -> int * int64

to_d_ps d is the span d as a pair (d, ps) expressing the POSIX picosecond span d * 86_400e12 + ps with ps in the range [0;86_399_999_999_999_999L]

Sourceval of_int_s : int -> t

of_int_s secs is a span from the signed integer POSIX second span secs.

Sourceval to_int_s : t -> int option

to_int_s d is the span d as a signed integer POSIX second span, if int's range can represent it (note that this depends on Sys.word_size). Subsecond precision numbers are truncated.

Sourceval of_float_s : float -> t option

of_float_s secs is a span from the signed floating point POSIX second span d. Subpicosecond precision numbers are truncated.

None is returned if secs cannot be represented as a span. This occurs on Stdlib.nan or if the duration in POSIX days cannot fit on an int (on 32-bit platforms this means the absolute magnitude of the duration is greater than ~2'941'758 years).

Sourceval to_float_s : t -> float

to_float_s s is the span s as floating point POSIX seconds.

Warning. The magnitude of s may not be represented exactly by the floating point value.

Sourceval of_mtime_span : Mtime.Span.t -> t

of_mtime_span span is a span from the monotonic span span.

Sourceval to_mtime_span : t -> Mtime.Span.t option

of_mtime_span span is the absolute value of span as a monotonic span or None if span cannot be represented.

Predicates

Sourceval equal : t -> t -> bool

equal d d' is true if and only if d and d' are the same time span.

Sourceval compare : t -> t -> int

compare d d' is a total order on durations that is compatible with signed time span order.

Sourceval is_shorter : t -> than:t -> bool

is_shorter span ~than is true if and only if span lasts stricly less than than.

Sourceval is_longer : t -> than:t -> bool

is_longer span ~than is true if and only if span lasts stricly more than than.

Arithmetic

Note. The following functions rollover on overflows.

Sourceval neg : t -> t

neg d is the span d negated.

Sourceval add : t -> t -> t

add d d' is d + d'.

Sourceval sub : t -> t -> t

sub d d' is d - d'.

Sourceval abs : t -> t

abs d is the absolute value of span d.

Pretty printing

Sourceval pp_d_ps : Format.formatter -> t -> unit

pp_d_ps ppf d prints an unspecified, approximative, representation of d on ppf.