Classes
Members
Record.<string, ServerTime>
# static constant SERVER_TIME_MAP
keep a local map of server times (export this purely for testing purposes)
each entry will map the server domain to the last-known time and the local time it was recorded, ex:
- Default Value:
- {}
Example
"horizon-testnet.stellar.org": {
serverTime: 1552513039,
localTimeRecorded: 1552513052
}
Methods
# static getCurrentServerTime(hostname) → {number}
Given a hostname, get the current time of that server (i.e., use the last- recorded server time and offset it by the time since then.) If there IS no recorded server time, or it's been 5 minutes since the last, return null.
Parameters:
Name | Type | Description |
---|---|---|
hostname |
string
|
Hostname of a Horizon server. |
The UNIX timestamp (in seconds, not milliseconds)
representing the current time on that server, or null
if we don't have
a record of that time.
number