Blizzard / heroprotocol

Python library to decode Heroes of the Storm replays
MIT License
398 stars 69 forks source link

how to convert 18 digit timestamp? #56

Closed junkwhinger closed 6 years ago

junkwhinger commented 7 years ago

Hi, using heroprotocol.py --detail I managed to parse my playlogs, but can't seem to parse timestamp correctly. For example the one i have is data['m_timeUTC'] = '131485808427443680'. On the replay section in the game it seems its '2017-04-17'. I'd appreciate if someone could tell me how to parse this in python. Thanks!

barrett777 commented 7 years ago

This is Windows filetime, which I believe is ticks since 1970. You can search online for windows filetime converters

junkwhinger commented 7 years ago

Thanks it works! :) here's my python code to convert Windows filetime to python datetime object. ts = datetime.datetime.fromtimestamp((data['m_timeUTC'] - 116444736000000000) // 10000000)

mehdi-kaytoue commented 7 years ago

Very helpful @junkwhinger, thank you!