NetworkTimestampDatetimeConverter

NetworkTimestampDatetimeConverter

Provides utilities for converting between network timestamps and datetimes.

Constructor

new NetworkTimestampDatetimeConverter(epoch, timeUnits)

Description:
  • Creates a converter given an epoch and base time units.

Source:
Parameters:
Name Type Description
epoch Date

Date at which network started.

timeUnits string

Time unit the network uses for progressing.

Classes

NetworkTimestampDatetimeConverter

Members

epoch :Date

Description:
  • Date at which network started

Source:

Date at which network started

Type:
  • Date

timeUnits :number

Description:
  • Number of milliseconds per time unit.

Source:

Number of milliseconds per time unit.

Type:
  • number

Methods

toDatetime(rawTimestamp) → {Date}

Description:
  • Converts a network timestamp to a datetime.

Source:
Parameters:
Name Type Description
rawTimestamp number

Raw network timestamp.

Returns:

Date representation of the network timestamp.

Type
Date

toDifference(referenceDatetime) → {number}

Description:
  • Subtracts the network epoch from the reference date.

Source:
Parameters:
Name Type Description
referenceDatetime Date

Reference date.

Returns:

Number of network time units between the reference date and the network epoch.

Type
number