package calendar

  1. Overview
  2. Docs

Module Ftime.PeriodSource

A period is the number of seconds between two times.

Arithmetic operations

include Period.S
Sourcetype +'a period constraint 'a = [< Period.date_field ]

Type of a period.

Period is an additive monoid

Sourceval empty : 'a period

The empty period.

Sourceval add : 'a period -> 'a period -> 'a period

Addition of periods.

Sourceval sub : 'a period -> 'a period -> 'a period

Substraction of periods.

Sourceval opp : 'a period -> 'a period

Opposite of a period.

Periods are comparable

Sourceval equal : 'a period -> 'b period -> bool

Equality function between two periods.

  • since 1.09.0
Sourceval compare : 'a period -> 'b period -> int

Comparison function between two periods.

Sourceval hash : 'a period -> int

Hash function for periods.

  • since 2.0
Sourceval length : 'a period -> second

Number of seconds of a period.

Sourceval mul : 'a period -> 'a period -> 'a period

Multiplication.

Sourceval div : 'a period -> 'a period -> 'a period

Division.

Constructors

Sourceval make : int -> int -> second -> 'a period

make hour minute second makes a period of the specified length.

Sourceval lmake : ?hour:int -> ?minute:int -> ?second:second -> unit -> 'a period

Labelled version of make. The default value is 0 for each argument.

Sourceval hour : int -> 'a period

hour n makes a period of n hours.

Sourceval minute : int -> 'a period

minute n makes a period of n minutes.

Sourceval second : second -> 'a period

second n makes a period of n seconds.

Getters

Sourceval to_seconds : 'a period -> second

Number of seconds of a period. @example to_seconds (make 1 2 3) returns 3600 + 120 + 3 = 3723.

  • since 1.04
Sourceval to_minutes : 'a period -> float

Number of minutes of a period. The resulting fractional part represents seconds. @example to_minutes (make 1 2 3) returns 60 + 2 + 0.05 = 62.05.

  • since 1.04
Sourceval to_hours : 'a period -> float

Number of hours of a period. The resulting fractional part represents minutes and seconds. @example to_hours (make 1 3 0) returns 1 + 0.05 = 1.05.

  • since 1.04
OCaml

Innovation. Community. Security.