message: fix: Parse time from string
diff: @@ -12,19 +12,19 @@ export class TimeAPI {
  TIME: `/time`,
  };
  - constructor(private readonly baseURL: string) {}
  + constructor(private readonly baseURL: string) {
  + }
  /**
  - * Get the server time from Coinbase Pro API.
  + * Get the server time from Coinbase Pro API. It has been reported that sometimes the return value is a string:
  + * https://github.com/bennycode/coinbase-pro-node/issues/354
  *
  * @see https://docs.pro.coinbase.com/#time
  */
  - async getTime(): Promise<TimeSkew> {
  + async getTime(): Promise<TimeSkew | string> {
  const response = await axios.get<TimeSkew>(`${this.baseURL}${TimeAPI.URL.TIME}`, {
  - headers: {
  - Accept: 'application/json',
  - 'Content-Type': 'application/json;charset=utf-8',
  - },
  + // This trick forces axios to set JSON headers
  + data: {},
  });
  return response.data;
  }
  @@ -33,8 +33,10 @@ export class TimeAPI {
  * Get the absolute difference between server time and local time.
  */
  async getClockSkew(): Promise<number> {
  - const {epoch} = await this.getTime();
  + const time = await this.getTime();
  + /** @see https://github.com/bennycode/coinbase-pro-node/issues/354 */
  + const epoch = (typeof time === 'string') ? parseFloat(time.match(/epoch":(.*)\./i)![1]) : time.epoch;
  const now = Date.now() / 1000;
  - return parseFloat(`${epoch}`) - now;
  + return epoch - now;
  }
  }
  