rewrote frame delay management using c++11 chrono