-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Feature to calculate BH, Modified Redirect Links, and Resolved …
…Minor Bugs (#775) Enhanced the logs table by adding contextual information such as timestamps and the number of blocks from NEAR's latest block for developers on the Logs Table.
- Loading branch information
1 parent
0c3b7cf
commit eb87759
Showing
8 changed files
with
46 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export const calculateBlockTimeDifference = (latestBlockHeight: number, currentBlockHeight: number): string => { | ||
const averageBlockTimeSeconds: number = 1.3; | ||
const blocksDifference: number = Math.abs(currentBlockHeight - latestBlockHeight); | ||
|
||
const timeDifferenceSeconds: number = blocksDifference * averageBlockTimeSeconds; | ||
|
||
const days: number = Math.floor(timeDifferenceSeconds / (3600 * 24)); | ||
const hours: number = Math.floor((timeDifferenceSeconds % (3600 * 24)) / 3600); | ||
const minutes: number = Math.floor((timeDifferenceSeconds % 3600) / 60); | ||
const seconds: number = Math.floor(timeDifferenceSeconds % 60); | ||
|
||
let timeDifferenceString: string = ''; | ||
if (days > 0) { | ||
timeDifferenceString += `${days}day${days > 1 ? 's' : ''} `; | ||
} | ||
if (hours > 0) { | ||
timeDifferenceString += `${hours}hr${hours > 1 ? 's' : ''} `; | ||
} | ||
if (minutes > 0 || hours > 0) { | ||
timeDifferenceString += `${minutes}min${minutes > 1 ? 's' : ''} `; | ||
} | ||
timeDifferenceString += `${seconds}s`; | ||
|
||
return timeDifferenceString.trim(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters