nn::os::Tick Class

Header file: nn/os.h

Syntax

class Tick

Description

Class for handling system ticks.

A system tick represents a single clock cycle of the CPU. The conversion constructors and conversion operators let you convert from ticks to nn::fnd::TimeSpan objects (which represent actual time), and vice versa. Use GetSystemCurrent to get the number of ticks that have occurred since the system was started up.

There are individual differences, and the system tick can vary widely by temperature, so the precision is somewhere around ±300 seconds per month. This value is not something that can be guaranteed in the retail product.

Time in terms of current date and time as gotten by the nn::fnd::DateTime::GetNow function progresses at a different speed, so the two values must not be used in combination. Even though you get values in the same unit with the nn::os::Tick::ToTimeSpan function, you do not get the same value even when you take the measurement at the same time.

Also, in most cases, time progresses at different rates in libraries that handle time internally (for example, for streaming playback of audio and video). So, for example, if you want to synchronize the application's gameplay with the sound playback, you need to understand the specifications for the individual libraries and use the same rate of time progression for both.

Member Constants

S TICKS_PER_SECOND const s64 Constant representing the number of ticks per second.

Member Functions

Constructor
Tick Constructor that takes a number of ticks and initializes an object.
S GetSystemCurrent Returns the number of ticks that have occurred since the system was started up.
Conversions
operator s64 Converts to a 64-bit tick value.
operator nn::fnd::TimeSpan Converts to a nn::fnd::TimeSpan value.
ToTimeSpan Converts to a nn::fnd::TimeSpan value.
Sums and Differences
operator-= Subtracts a tick value.
operator- Finds the difference between tick values.
operator+= Adds a tick value.
operator+ Finds the sum of tick values.
Conversion to Second Units
ToNanoSeconds Converts to nanosecond units.
ToMicroSeconds Converts to microsecond units.
ToMilliSeconds Converts to millisecond units.
ToSeconds Converts to second units.

Revision History

2012/05/25
Categorized the member functions.
Added the operator-series functions.
2012/01/17
Noted that mixed use with nn::fnd::DateTime::GetNow is prohibited, and added a description of precision.
2010/01/07
Initial version.

CONFIDENTIAL