Equivalent of std::chronos::high_resolution_clock and high_resolution_clock::time_point in the 3ds.h

Discussion in '3DS - Homebrew Development and Emulators' started by delete12345, Nov 5, 2016.

  1. delete12345
    OP

    delete12345 GBAtemp Fan

    Member
    398
    164
    Feb 27, 2010
    United States
    Taipei, Taiwan
    In C++, you have this in the standard library:

    Code:
    std::chronos::high_resolution_clock
    std::chronos::high_resolution_clock::time_point
    What is the equivalent of a high resolution clock value used in ctrulib?

    Is it osGetTime()? And that is it?
     
  2. elhobbs

    elhobbs GBAtemp Advanced Fan

    Member
    784
    292
    Jul 28, 2008
    United States
    svcGetSystemTick is good for measuring small amounts of elapsed time with a high resolution, but it is not super accurate over long periods of time.
     
  3. delete12345
    OP

    delete12345 GBAtemp Fan

    Member
    398
    164
    Feb 27, 2010
    United States
    Taipei, Taiwan
    osGetTime() is therefore more accurate over long periods of time?
     
  4. elhobbs

    elhobbs GBAtemp Advanced Fan

    Member
    784
    292
    Jul 28, 2008
    United States
    That depends on what you need for accuracy. Neither one can be used to accurately synchronize a circular buffer for sound playback. But I do believe osGetTime will stay somewhat in sync with the current time. For measuring/comparing elapsed time for things during a frame I would use the tick count. For measuring seconds/minutes I would use os get time.
     
  5. delete12345
    OP

    delete12345 GBAtemp Fan

    Member
    398
    164
    Feb 27, 2010
    United States
    Taipei, Taiwan
    Ok, because I'm still working on the physics engine, and I need tons of accurate timing. :P

    I'll stick with osGetTime() then, as I prefer stable/less accuracy over unstable/high accuracy.
     
  6. elhobbs

    elhobbs GBAtemp Advanced Fan

    Member
    784
    292
    Jul 28, 2008
    United States
    Game physics? You don't need much precision for that - either one should work fine. Unless you are running the physics simulation much faster than the typical 60 Hz graphics refresh rate.
     
  7. delete12345
    OP

    delete12345 GBAtemp Fan

    Member
    398
    164
    Feb 27, 2010
    United States
    Taipei, Taiwan
    It's the physics engine that I'm working on, Pica. But I'll stick with the osGetTime() for now.