Use more accurate epoch duration calculation in explorer (#11359)
This commit is contained in:
parent
247e361d23
commit
ebe14415f6
|
@ -62,12 +62,16 @@ function StatsCardBody() {
|
|||
}
|
||||
|
||||
const currentBlock = rootSlot.toLocaleString("en-US");
|
||||
const { avgBlockTime_1min, epochInfo } = dashboardInfo;
|
||||
const { avgBlockTime_1h, avgBlockTime_1min, epochInfo } = dashboardInfo;
|
||||
const hourlyBlockTime = Math.round(1000 * avgBlockTime_1h);
|
||||
const averageBlockTime = Math.round(1000 * avgBlockTime_1min) + "ms";
|
||||
const { slotIndex, slotsInEpoch } = epochInfo;
|
||||
const currentEpoch = epochInfo.epoch.toString();
|
||||
const epochProgress = ((100 * slotIndex) / slotsInEpoch).toFixed(1) + "%";
|
||||
const epochTimeRemaining = slotsToHumanString(slotsInEpoch - slotIndex);
|
||||
const epochTimeRemaining = slotsToHumanString(
|
||||
slotsInEpoch - slotIndex,
|
||||
hourlyBlockTime
|
||||
);
|
||||
const averageTps = Math.round(performanceInfo.avgTPS);
|
||||
const transactionCount = <AnimatedTransactionCount info={performanceInfo} />;
|
||||
|
||||
|
|
|
@ -52,6 +52,9 @@ HUMANIZER.addLanguage("short", {
|
|||
decimal: ".",
|
||||
});
|
||||
|
||||
export function slotsToHumanString(slots: number): string {
|
||||
return HUMANIZER.humanize(slots * MS_PER_SLOT);
|
||||
export function slotsToHumanString(
|
||||
slots: number,
|
||||
slotTime = MS_PER_SLOT
|
||||
): string {
|
||||
return HUMANIZER.humanize(slots * slotTime);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue