Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getBlockTimeDelta() {
try {
let bt =
(this.getBlockTime().getTime() +
ChainStore.getEstimatedChainTimeOffset()) /
1000;
let now = new Date().getTime() / 1000;
return Math.abs(now - bt);
} catch (err) {
console.log(err);
return -1;
}
}
render() {
let {time, chain_time} = this.props;
var offset_mills = chain_time
? ChainStore.getEstimatedChainTimeOffset()
: 0;
if (!time) {
return null;
}
if (
typeof time === "string" &&
time.indexOf("+") === -1 &&
!/Z$/.test(time)
) {
time += "Z";
}
let timePassed = Math.round(
(new Date().getTime() - new Date(time).getTime() + offset_mills) /
1000
);
getBlockTimeDelta() {
try {
let bt =
(this.getBlockTime().getTime() +
ChainStore.getEstimatedChainTimeOffset()) /
1000;
let now = new Date().getTime() / 1000;
return Math.abs(now - bt);
} catch (err) {
return -1;
}
}
getBlockTimeDelta() {
try {
let bt =
(this.getBlockTime().getTime() +
ChainStore.getEstimatedChainTimeOffset()) /
1000;
let now = new Date().getTime() / 1000;
return Math.abs(now - bt);
} catch (err) {
return -1;
}
}