Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TimeType

A type storing a specific time of day, with millisecond precision. The value is stored as a 4-byte unsigned integer. Writes Date objects, but their year, month, and date are ignored.

When values are read, they are set to the arbitrary day of 1970-01-01.

Example:

let type = new sb.TimeType

Hierarchy

  • ChronoType
    • TimeType

Index

Constructors

constructor

  • Returns TimeType

Accessors

Static _value

  • get _value(): number

Methods

addToBuffer

consumeValue

  • consumeValue(buffer: ArrayBuffer, offset: number): ReadResult<Date>
  • Parameters

    • buffer: ArrayBuffer
    • offset: number

    Returns ReadResult<Date>

equals

  • equals(otherType: unknown): boolean
  • Parameters

    • otherType: unknown

    Returns boolean

getHash

  • getHash(): string

getSignature

  • getSignature(): string

Private isBuffer

Private isSameType

  • isSameType(otherType: unknown): otherType is TimeType
  • Determines whether the input is a Type with the same class

    Parameters

    • otherType: unknown

      A value, usually a Type instance

    Returns otherType is TimeType

    whether this and otherType are instances of the same Type class

readValue

  • readValue(valueBuffer: ArrayBuffer | Uint8Array, offset?: number): Date
  • Parameters

    • valueBuffer: ArrayBuffer | Uint8Array
    • offset: number = 0

    Returns Date

toBuffer

  • toBuffer(): ArrayBuffer

valueBuffer

  • valueBuffer(value: Date): ArrayBuffer
  • Parameters

    • value: Date

    Returns ArrayBuffer

writeValue

  • Appends value bytes to an AppendableBuffer according to the type

    Example:

    type.writeValue(buffer, new Date(2017, 0, 1, 16, 37, 24, 189)) //16:37:24.189
    
    throws

    If the value doesn't match the type, e.g. new sb.StringType().writeValue(buffer, 23)

    Parameters

    • buffer: AppendableBuffer

      The buffer to which to append

    • value: Date

      The value to write

    Returns void

Generated using TypeDoc