Identifier index | Structure index |
---|

(* Time -- SML Basis Library *) eqtype time exception Time val zeroTime : time val now : unit -> time val toSeconds : time -> int val toMilliseconds : time -> int val toMicroseconds : time -> int val fromSeconds : int -> time val fromMilliseconds : int -> time val fromMicroseconds : int -> time val fromReal : real -> time val toReal : time -> real val toString : time -> string (* rounded to millisecond precision *) val fmt : int -> time -> string val fromString : string -> time option val scan : (char, 'a) StringCvt.reader -> (time, 'a) StringCvt.reader val + : time * time -> time val - : time * time -> time val < : time * time -> bool val <= : time * time -> bool val > : time * time -> bool val >= : time * time -> bool val compare : time * time -> order (* [time] is a type for representing durations as well as absolute points in time (which can be thought of as durations since some fixed time zero). Times can be negative, zero, or positive. [zeroTime] represents the 0-second duration, and the origin of time, so zeroTime + t = t + zeroTime = t for all t. [now()] returns the point in time at which the application occurs. [fromSecondss] returns the time value corresponding to s seconds. [fromMillisecondsms] returns the time value corresponding to ms milliseconds. [fromMicrosecondsus] returns the time value corresponding to us microseconds. [toSecondst] returns the number of seconds represented by t, truncated (towards zero). Raises Overflow if that number is not representable as an int. [toMillisecondst] returns the number of milliseconds represented by t, truncated (towards zero). Raises Overflow if that number is not representable as an int. [toMicrosecondst] returns the number of microseconds represented by t, truncated (towards zero). Raises Overflow if t that number is not representable as an int. [fromRealr] converts a real to a time value representing that many seconds. It holds that fromReal 0.0 = zeroTime. [toRealt] converts a time to the number of seconds it represents; hence fromReal and toReal are inverses of each other. [fmtn t] returns as a string the number of seconds represented by t, rounded to n decimal digits. If n <= 0, then no decimal digits are reported. [toStringt] returns as a string the number of seconds represented by t, rounded to 3 decimal digits. Equivalent to (fmt 3 t). [fromStrings] returns SOME t where t is the time value represented by the string s of form [\n\t ]*[+~-]?(([0-9]+(\.[0-9]+)?)|(\.[0-9]+)); or returns NONE if s cannot be parsed as a time value. [scangetc src], where getc is a character accessor, returns SOME (t, rest) where t is a time and rest is rest of the input, or NONE if s cannot be parsed as a time value. [+] adds two time values. For reals r1, r2 >= 0.0, it holds that fromReal r1 + fromReal r2 = fromReal(Real.+(r1,r2)). Raises Overflow if the result is not representable as a time value. [-] subtracts a time value from another. That is, t1 - t2 is the duration from t2 to t1 (which may be negative). It holds that t - zeroTime = t. [<] [<=] [>] [>=] compares time values. For instance, for reals r1, r2 >= 0.0 it holds that fromReal r1 < fromReal r2 iff Real.<(r1, r2) [compare(t1, t2)] returns LESS, EQUAL, or GREATER, according as t1 precedes, equals, or follows t2 in time. *)

Identifier index | Structure index |
---|