Class: TimeData

protocol~TimeData(limitopt)

Time Data An object which handles "adjusted time". This may not look it, but this is actually a semi-consensus-critical piece of code. It handles version packets from peers and calculates what to offset our system clock's time by.

Constructor

new TimeData(limitopt)

Create time data.

Extends:
  • EventEmitter
Parameters:
Name Type Attributes Default Description
limit Number <optional>
200
Properties:
Name Type Description
samples Array
known Object
limit Number
offset Number
Source:

Extends

  • EventEmitter

Methods

add(id, time)

Add time data.

Parameters:
Name Type Description
id String
time Number
Source:

adjust(time) → {Number}

Adjust a timestamp.

Parameters:
Name Type Description
time Number
Source:
Returns:

Adjusted Time.

Type
Number

local(time) → {Number}

Unadjust a timestamp.

Parameters:
Name Type Description
time Number
Source:
Returns:

Local Time.

Type
Number

ms() → {Number}

Get the current adjusted time in milliseconds.

Source:
Returns:

Adjusted Time.

Type
Number

now() → {Number}

Get the current adjusted time.

Source:
Returns:

Adjusted Time.

Type
Number