6.16. Advanced Features - Synchronization Clock

Stations participating in the session can get the time elapsed since the session host created the session in milliseconds. This feature is called the synchronization clock.

Getting the Synchronization Clock

Time is synchronized within the session by the periodic sending of time synchronization pulses by the clients and responses from the host. The interval for the sending of the time synchronization pulse can be changed to any time (in milliseconds).

Code 6-38. Getting the Time Elapsed Since the Session Was Created
// Can be run while participating in a session.
// Query the Session class to get the time elapsed since the session was created.
s64 sessionTime = nn::pia::session::Session::GetInstance()->GetTime();

 

Code 6-39. Checking and Changing the Interval for Sending the Time Synchronization Pulse
// Can be run while participating in a session.
 
// Check the interval for sending the time synchronization pulse.
s32 currentPulseInterval = nn::pia::session::Session::GetInstance()->GetSyncClockPulseInterval();
 
// Change the interval for sending the time synchronization pulse.
s32 pulseInterval; // Assume this variable is set to the send interval (in milliseconds) that you want to change.
nn::pia::session::Session::GetInstance()->SetSyncClockPulseInterval(pulseInterval);

 

 

Reference:

The synchronization clock cannot be obtained while sessions are being joined together by the joint session feature.