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

delete12345

Well-Known Member
OP
Member
Joined
Feb 27, 2010
Messages
695
Trophies
1
Age
32
Location
Taipei, Taiwan
XP
1,276
Country
United States
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?
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,032
Country
United States
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?
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.
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,032
Country
United States
osGetTime() is therefore more accurate over long periods of time?
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.
 

delete12345

Well-Known Member
OP
Member
Joined
Feb 27, 2010
Messages
695
Trophies
1
Age
32
Location
Taipei, Taiwan
XP
1,276
Country
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.
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.
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,032
Country
United States
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.
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.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    OctoAori20 @ OctoAori20: Nice nice-