question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Working with timestamps

See original GitHub issue

Hi, Thank you for your amazing library !

I have a hard time converting timestamps to valid datetimes and wouldn’t mind a bit of help. Here is what I’m doing :

  1. Create a stream for orderbook depth via create_stream() with depth20@100ms
  2. Fetch the lastest data from the stream via oldest_stream_data_from_stream_buffer = binance_websocket_api_manager.pop_stream_data_from_stream_buffer()
  3. Get the timestamp of the lastest data using oldest_stream_data_from_stream_buffer['last_update_id']

This gives me a timestamp like 2046077850. Fair enough, let’s convert it to a datetime object : print(datetime.datetime.utcfromtimestamp(2046077850)) results in 2034-11-02 10:57:30, which is nowhere near the current time.

How can I have the correct datetime, with milliseconds ?

Sorry if this not fully related to this library, I can delete my issue as soon as it’s resolved if you want.

DrPaprikaa

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
oliver-zehentleitnercommented, Dec 31, 2020

for that the stream_buffer doesnt help but if its not empty or not almost empty you know there is a delay…

I think a pop() delivers the latest entry, a pop(0) delivers the oldest entrie… anyway. It seems there are faster and better ways to do so. https://docs.python.org/2/tutorial/datastructures.html#using-lists-as-queues

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working with Timestamps - Oracle Help Center
Working with Timestamps. To specify a timestamp value in a query, provide it as a string, and cast it to a Timestamp data...
Read more >
Handy Dandy Guide to Working With Timestamps in pandas
This article is your handy dandy guide to working with timestamps in pandas. We'll cover the most common problems people deal with when ......
Read more >
Working with Timestamps - Services.amazon.com
The Timestamp attribute must contain the client's machine time in ISO 8601 date time format; requests with a timestamp significantly different (15 minutes)...
Read more >
Timestamps, Time Zones, Time Ranges, and Date Formats
Learn how Sumo Logic manages timestamps, time zones, time ranges, and dates, and the configuration options that are available.
Read more >
Using Dates and Timestamps - Snowflake Documentation
Calculating Business Calendar Dates and Times​​ Get the first day of the month as a DATE value using the DATE_TRUNC function. For example,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found