package orsetto

  1. Overview
  2. Docs
On This Page
  1. Overview
Legend:
Library
Module
Module type
Parameter
Class
Class type

Civil time in the 24-hour digital clock face notation.

Overview

This module implements record types inhabited by 24-hour digital clock face indications. It also provides related functions and types to facilitate conversion to and from various formats for data interchange.

type time = private
  1. | Time of {
    1. hour : int;
      (*

      0 .. 23

      *)
    2. minute : int;
      (*

      0 .. 59

      *)
    3. second : int;
      (*

      0 .. 59, 60 if leap second

      *)
    }

The private type inhabited by 24-hour civil time values.

val create : hour:int -> minute:int -> second:int -> time

Use create ~hour ~minute ~second to create a 24-hour clock time value according to the ~hour, ~minute and ~second parameters. Raises Invalid_argument if the time specified is not a valid clock time. A clock time with second = 60 is only valid when hour = 23 and minute = 59 (as leap seconds may appear only at the end of an day, according to standard).

val to_seconds : time -> int

Use to_seconds t to convert the time to an integer number of seconds since midnight (without counting any preceding leap seconds).

OCaml

Innovation. Community. Security.