Search code examples
c++wxwidgets

wxGetElapsedTime function in wxWidgets 2.9+


I'm trying to follow some old C++ tutorial which use old version o wxWidgets framework (2.6 I think), but I have complied version 2.9.1, where I could not find wxGetElapsedTime() and wxStartTimer() methods.

The elapsed time method is used as argument to srand() method to 'randomize' initial random seed value and the author of the tutorial use after that wxStartTimer() to reset timer to zero (instead of use wxGetElapsedTime(true)).

srand(wxGetElapsedTime(false));
wxStartTimer();

After some search on Google I found, that those methods are deprecated, but I could not find some clue which functions are used in 2.9+ wxWidgets instead.


Solution

  • try

    srand((int)wxGetLocalTime());
    

    and

    wxStopWatch * stopWatch = new wxStopWatch();
    
    updateSomethingByTime( stopWatch->Time() );