TimeMathType: {
    absValue: ((abs) => TimestampValue);
    addAbsRel: ((abs, rel) => T);
    addRelRel: ((rel1, rel2) => T);
    clampedSubtractAbsAbs: ((abs1, abs2) => RelativeTime);
    coerceRelativeTimeRecord: ((rel, brand) => RelativeTimeRecord);
    coerceTimestampRecord: ((abs, brand) => TimestampRecord);
    compareAbs: ((abs1, abs2) => RankComparison);
    compareRel: ((rel1, rel2) => RankComparison);
    divideRelNat: ((rel, nat) => RelativeTime);
    divideRelRel: ((rel1, rel2) => bigint);
    isRelZero: ((rel) => boolean);
    modAbsRel: ((abs, step) => RelativeTime);
    modRelRel: ((rel, step) => RelativeTime);
    multiplyRelNat: ((rel, nat) => RelativeTime);
    relValue: ((rel) => RelativeTimeValue);
    subtractAbsAbs: ((abs1, abs2) => RelativeTime);
    subtractAbsRel: ((abs, rel) => Timestamp);
    subtractRelRel: ((rel1, rel2) => RelativeTime);
}

Type declaration

  • absValue: ((abs) => TimestampValue)
      • (abs): TimestampValue
      • Validates that the operand represents a Timestamp and returns the bigint representing its absolute time value. During the transition explained in theTimeMath comment, absValue will also accept a bigint which it then just returns.

        Parameters

        Returns TimestampValue

  • addAbsRel: ((abs, rel) => T)
      • (abs, rel): T
      • An absolute time + a relative time gives a new absolute time.

        Parameters

        Returns T

  • addRelRel: ((rel1, rel2) => T)
      • (rel1, rel2): T
      • A relative time (i.e., a duration) + another relative time gives a new relative time.

        Parameters

        • rel1: T
        • rel2: T

        Returns T

  • clampedSubtractAbsAbs: ((abs1, abs2) => RelativeTime)
      • (abs1, abs2): RelativeTime
      • The difference between two absolute times is a relative time. If abs1 > abs2 the difference would be negative, so this method returns a zero relative time instead.

        Parameters

        Returns RelativeTime

  • coerceRelativeTimeRecord: ((rel, brand) => RelativeTimeRecord)
      • (rel, brand): RelativeTimeRecord
      • Coerces to a RelativeTime if possible. If a brand is provided, ensure it matches and return a RelativeTime labeled with that brand.

        Parameters

        Returns RelativeTimeRecord

  • coerceTimestampRecord: ((abs, brand) => TimestampRecord)
      • (abs, brand): TimestampRecord
      • Coerces to a TimestampRecord if possible, else throws. If the value has a brand, ensure it matches. Return a Timestamp labeled with that brand.

        Parameters

        Returns TimestampRecord

  • compareAbs: ((abs1, abs2) => RankComparison)
      • (abs1, abs2): RankComparison
      • Compares two absolute times. This comparison function is compatible with JavaScript's Array.prototype.sort and so can be used to sort an array of absolute times. The result is -1, 0, or 1 indicating whether the first argument is less than, equal, or greater than the second.

        Parameters

        Returns RankComparison

  • compareRel: ((rel1, rel2) => RankComparison)
      • (rel1, rel2): RankComparison
      • Compares two relative times. This comparison function is compatible with JavaScript's Array.prototype.sort and so can be used to sort an array of relative times. The result is -1, 0, or 1 indicating whether the first argument is less than, equal, or greater than the second.

        Parameters

        Returns RankComparison

  • divideRelNat: ((rel, nat) => RelativeTime)
  • divideRelRel: ((rel1, rel2) => bigint)
  • isRelZero: ((rel) => boolean)
      • (rel): boolean
      • Does it represent a zero relative time, i.e., the difference of an absolute time with itself? (We choose not to define a similar isAbsZero, even though we could, because it is much less likely to be meaningful.)

        Parameters

        Returns boolean

  • modAbsRel: ((abs, step) => RelativeTime)
      • (abs, step): RelativeTime
      • An absolute time modulo a relative time is a relative time. For example, 20:17 on July 20, 1969 modulo 1 day is just 20:17, a relative time that can be added to the beginning of any day.

        Parameters

        Returns RelativeTime

  • modRelRel: ((rel, step) => RelativeTime)
  • multiplyRelNat: ((rel, nat) => RelativeTime)
  • relValue: ((rel) => RelativeTimeValue)
      • (rel): RelativeTimeValue
      • Validates that the operand represents a RelativeTime and returns the bigint representing its relative time value. During the transition explained in theTimeMath comment, relValue will also accept a bigint which it then just returns.

        Parameters

        Returns RelativeTimeValue

  • subtractAbsAbs: ((abs1, abs2) => RelativeTime)
      • (abs1, abs2): RelativeTime
      • The difference between two absolute times is a relative time. If abs1 > abs2 the difference would be negative, so this method throws instead.

        Parameters

        Returns RelativeTime

  • subtractAbsRel: ((abs, rel) => Timestamp)
  • subtractRelRel: ((rel1, rel2) => RelativeTime)

Generated using TypeDoc