aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-watcher/src/utils/utils.ts
blob: d34f6b99f9238ecd3c8efae5ba97823d519b3c71 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { BigNumber } from '@0xproject/utils';

export const utils = {
    spawnSwitchErr(name: string, value: any): Error {
        return new Error(`Unexpected switch value: ${value} encountered for ${name}`);
    },
    getCurrentUnixTimestampSec(): BigNumber {
        const milisecondsInASecond = 1000;
        return new BigNumber(Date.now() / milisecondsInASecond).round();
    },
    getCurrentUnixTimestampMs(): BigNumber {
        return new BigNumber(Date.now());
    },
};