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 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 averageBlockTime = Math.round(1000 * avgBlockTime_1min) + "ms";
|
||||||
const { slotIndex, slotsInEpoch } = epochInfo;
|
const { slotIndex, slotsInEpoch } = epochInfo;
|
||||||
const currentEpoch = epochInfo.epoch.toString();
|
const currentEpoch = epochInfo.epoch.toString();
|
||||||
const epochProgress = ((100 * slotIndex) / slotsInEpoch).toFixed(1) + "%";
|
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 averageTps = Math.round(performanceInfo.avgTPS);
|
||||||
const transactionCount = <AnimatedTransactionCount info={performanceInfo} />;
|
const transactionCount = <AnimatedTransactionCount info={performanceInfo} />;
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,9 @@ HUMANIZER.addLanguage("short", {
|
||||||
decimal: ".",
|
decimal: ".",
|
||||||
});
|
});
|
||||||
|
|
||||||
export function slotsToHumanString(slots: number): string {
|
export function slotsToHumanString(
|
||||||
return HUMANIZER.humanize(slots * MS_PER_SLOT);
|
slots: number,
|
||||||
|
slotTime = MS_PER_SLOT
|
||||||
|
): string {
|
||||||
|
return HUMANIZER.humanize(slots * slotTime);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue