Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timestamp is not UNIX time (x1000 value returned) #10

Closed
momijiame opened this issue Feb 14, 2020 · 1 comment
Closed

timestamp is not UNIX time (x1000 value returned) #10

momijiame opened this issue Feb 14, 2020 · 1 comment

Comments

@momijiame
Copy link

timestamp parameters are not UNIX time.
Actually, they are 1000 times (milliseconds) of UNIX time.

There are two possibilities:

  1. implementation is correct / documentation is wrong
  2. documentation is correct / implementation is wrong

Expected Behavior

  • If (1) is correct
    • need to fix the representation of the document (1000 times)
  • If (2) is correct
    • need to fix implementation (divide by 1000)

Current Behavior

Returned x1000 value of UNIX time.

Steps to Reproduce

$ curl -s "https://public.bitbank.cc/btc_jpy/ticker" | jq ".data.timestamp"
1581669923800
$ date +%s
1581669928
$ BITBANK_TIMESTAMP=$(curl -s "https://public.bitbank.cc/btc_jpy/ticker" | jq ".data.timestamp")
$ python -c "from datetime import datetime; print(datetime.fromtimestamp($BITBANK_TIMESTAMP))"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ValueError: year 52091 is out of range
$ python -c "from datetime import datetime; print(datetime.fromtimestamp($(($BITBANK_TIMESTAMP / 1000))))"
2020-02-14 17:45:51

Context (Environment)

Detailed Description

@daiki-ojima
Copy link
Contributor

@momijiame

Thank you for the bug report.

  1. implementation is correct / documentation is wrong

This is correct.
Fix documentation (update 2020-02-17).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants