How to use the bitsharesjs.ChainStore.getEstimatedChainTimeOffset function in bitsharesjs

To help you get started, we’ve selected a few bitsharesjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitshares / bitshares-ui / app / components / Layout / Footer.jsx View on Github external
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;
        }
    }
github bitshares / bitshares-ui / app / components / Utility / TimeAgo.jsx View on Github external
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
        );
github bitshares / bitshares-ui / app / App.jsx View on Github external
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;
        }
    }
github bitshares / bitshares-ui / app / App.jsx View on Github external
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;
        }
    }