ggerganov / imtui

ImTui: Immediate Mode Text-based User Interface C++ Library
https://imtui.ggerganov.com
MIT License
2.94k stars 123 forks source link

Dates getting displayed as huge numbers on macos #3

Closed bobbykjack closed 4 years ago

bobbykjack commented 4 years ago

hnterm

I'm running macOS 10.14.6 and can provide any other details on request.

ggerganov commented 4 years ago

Based on this SO thread, you can try replacing the following line:

return std::chrono::duration_cast<std::chrono::seconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count(); // duh ..

with

return std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count(); // duh ..

The hypothesis is that only system_clock is guaranteed to return Unix time. If you get the chance to try it, please let me know. Thanks!

bobbykjack commented 4 years ago

Yup, confirmed that fixes it.

grab 2019-12-16 at 21 42 59
ggerganov commented 4 years ago

Great! Feel free to make a PR

bobbykjack commented 4 years ago

Well, I don't have any access to other platforms, and I'm not really comfortable dealing with any portability issues on this one, so I'll leave it up to you if that's ok! Cheers.