OpenSiv3D  v0.6.5
C++20 framework for creative coding
s3d::Stopwatch Class Reference

ストップウォッチ More...

#include <Stopwatch.hpp>

Public Member Functions

SIV3D_NODISCARD_CXX20 Stopwatch (StartImmediately startImmediately=StartImmediately::No, ISteadyClock *pSteadyClock=nullptr)
 ストップウォッチを作成します。 More...
 
SIV3D_NODISCARD_CXX20 Stopwatch (const Duration &startTime, StartImmediately startImmediately=StartImmediately::No, ISteadyClock *pSteadyClock=nullptr)
 指定した時間だけ経過し一時停止している状態のストップウォッチを作成します。 More...
 
bool isStarted () const noexcept
 ストップウォッチが動作中であるかを示します(開始後の一時停止も動作中に含みます)。 More...
 
bool isPaused () const noexcept
 ストップウォッチが一時停止中であるかを示します。 More...
 
bool isRunning () const noexcept
 ストップウォッチが時間を計測中であるかを示します。 More...
 
void start ()
 ストップウォッチを開始・再開します。 More...
 
void pause ()
 開始しているストップウォッチを一時停止します。 More...
 
void resume ()
 ストップウォッチが一時停止中である場合、再開します。 More...
 
void reset () noexcept
 ストップウォッチを停止し、経過時間を 0 にリセットします。 More...
 
void restart ()
 経過時間を 0 にリセットして、ストップウォッチを再び開始します。 More...
 
void set (const Duration &time)
 ストップウォッチの経過時間を変更します。 More...
 
int32 d () const
 経過時間を [日] で返します。 More...
 
int64 d64 () const
 経過時間を [日] で返します。 More...
 
double dF () const
 経過時間を [日] で返します。 More...
 
int32 h () const
 経過時間を [時] で返します。 More...
 
int64 h64 () const
 経過時間を [時] で返します。 More...
 
double hF () const
 経過時間を [時] で返します。 More...
 
int32 min () const
 経過時間を [分] で返します。 More...
 
int64 min64 () const
 経過時間を [分] で返します。 More...
 
double minF () const
 経過時間を [分] で返します。 More...
 
int32 s () const
 経過時間を [秒] で返します。 More...
 
int64 s64 () const
 経過時間を [秒] で返します。 More...
 
double sF () const
 経過時間を [秒] で返します。 More...
 
int32 ms () const
 経過時間を [ミリ秒] で返します。 More...
 
int64 ms64 () const
 経過時間を [ミリ秒] で返します。 More...
 
double msF () const
 経過時間を [ミリ秒] で返します。 More...
 
int64 us () const
 経過時間を [マイクロ秒] で返します。 More...
 
int64 us64 () const
 経過時間を [マイクロ秒] で返します。 More...
 
double usF () const
 経過時間を [マイクロ秒] で返します。 More...
 
Duration elapsed () const
 経過時間を返します。 More...
 
String format (StringView format=U"H:mm:ss.xx"_sv) const
 経過時間を文字列に変換します。 DD 日 (00-) D 日 (0-) dd 日 (00-) d 日 (0-) HH 時 (00-) H 時 (0-) hh 時 (00-24) h 時 (0-24) MM 分 (00-) M 分 (0-) mm 分 (00-59) m 分 (0-59) SS 秒 (00-) S 秒 (0-) ss 秒 (00-59) s 秒 (0-59) X ミリ秒 (0-) x 小数点以下 1 桁秒 (0-9) xx 小数点以下 2 桁秒 (00-99) xxx 小数点以下 3 桁秒 (000-999) More...
 

Friends

bool operator< (const Stopwatch &s, const MicrosecondsF &time)
 経過時間を比較します。 More...
 
bool operator<= (const Stopwatch &s, const MicrosecondsF &time)
 経過時間を比較します。 More...
 
bool operator> (const Stopwatch &s, const MicrosecondsF &time)
 経過時間を比較します。 More...
 
bool operator>= (const Stopwatch &s, const MicrosecondsF &time)
 経過時間を比較します。 More...
 
bool operator< (const MicrosecondsF &time, const Stopwatch &s)
 経過時間を比較します。 More...
 
bool operator<= (const MicrosecondsF &time, const Stopwatch &s)
 経過時間を比較します。 More...
 
bool operator> (const MicrosecondsF &time, const Stopwatch &s)
 経過時間を比較します。 More...
 
bool operator>= (const MicrosecondsF &time, const Stopwatch &s)
 経過時間を比較します。 More...
 
template<class CharType >
std::basic_ostream< CharType > & operator<< (std::basic_ostream< CharType > &output, const Stopwatch &value)
 
void Formatter (FormatData &formatData, const Stopwatch &value)
 

Detailed Description

ストップウォッチ

Constructor & Destructor Documentation

◆ Stopwatch() [1/2]

SIV3D_NODISCARD_CXX20 s3d::Stopwatch::Stopwatch ( StartImmediately  startImmediately = StartImmediately::No,
ISteadyClock pSteadyClock = nullptr 
)
explicit

ストップウォッチを作成します。

Parameters
startImmediately即座に計測を開始する場合は StartImmediately::Yes
pSteadyClock基準時刻取得用のカスタム関数。nullptr の場合はシステム時刻

◆ Stopwatch() [2/2]

SIV3D_NODISCARD_CXX20 s3d::Stopwatch::Stopwatch ( const Duration startTime,
StartImmediately  startImmediately = StartImmediately::No,
ISteadyClock pSteadyClock = nullptr 
)
explicit

指定した時間だけ経過し一時停止している状態のストップウォッチを作成します。

Parameters
startTime経過時間
startImmediately即座に計測を開始する場合は StartImmediately::Yes
pSteadyClock基準時刻取得用のカスタム関数。nullptr の場合はシステム時刻

Member Function Documentation

◆ d()

int32 s3d::Stopwatch::d ( ) const

経過時間を [日] で返します。

Returns
経過時間 [日]

◆ d64()

int64 s3d::Stopwatch::d64 ( ) const

経過時間を [日] で返します。

Returns
経過時間 [日]

◆ dF()

double s3d::Stopwatch::dF ( ) const

経過時間を [日] で返します。

Returns
経過時間 [日]

◆ elapsed()

Duration s3d::Stopwatch::elapsed ( ) const

経過時間を返します。

Returns
経過時間

◆ format()

String s3d::Stopwatch::format ( StringView  format = U"H:mm:ss.xx"_sv) const

経過時間を文字列に変換します。 DD 日 (00-) D 日 (0-) dd 日 (00-) d 日 (0-) HH 時 (00-) H 時 (0-) hh 時 (00-24) h 時 (0-24) MM 分 (00-) M 分 (0-) mm 分 (00-59) m 分 (0-59) SS 秒 (00-) S 秒 (0-) ss 秒 (00-59) s 秒 (0-59) X ミリ秒 (0-) x 小数点以下 1 桁秒 (0-9) xx 小数点以下 2 桁秒 (00-99) xxx 小数点以下 3 桁秒 (000-999)

Parameters
formatフォーマット指定
Returns
フォーマットされた時間

◆ h()

int32 s3d::Stopwatch::h ( ) const

経過時間を [時] で返します。

Returns
経過時間 [時]

◆ h64()

int64 s3d::Stopwatch::h64 ( ) const

経過時間を [時] で返します。

Returns
経過時間 [時]

◆ hF()

double s3d::Stopwatch::hF ( ) const

経過時間を [時] で返します。

Returns
経過時間 [時]

◆ isPaused()

bool s3d::Stopwatch::isPaused ( ) const
noexcept

ストップウォッチが一時停止中であるかを示します。

Returns
ストップウォッチが開始後一時停止中である場合 true, それ以外の場合は false

◆ isRunning()

bool s3d::Stopwatch::isRunning ( ) const
noexcept

ストップウォッチが時間を計測中であるかを示します。

Returns
ストップウォッチが開始されていて、なおかつ一時停止中でない場合 true, それ以外の場合は false

◆ isStarted()

bool s3d::Stopwatch::isStarted ( ) const
noexcept

ストップウォッチが動作中であるかを示します(開始後の一時停止も動作中に含みます)。

Returns
ストップウォッチが開始されている、または開始後一時停止中である場合 true, それ以外の場合は false

◆ min()

int32 s3d::Stopwatch::min ( ) const

経過時間を [分] で返します。

Returns
経過時間 [分]

◆ min64()

int64 s3d::Stopwatch::min64 ( ) const

経過時間を [分] で返します。

Returns
経過時間 [分]

◆ minF()

double s3d::Stopwatch::minF ( ) const

経過時間を [分] で返します。

Returns
経過時間 [分]

◆ ms()

int32 s3d::Stopwatch::ms ( ) const

経過時間を [ミリ秒] で返します。

Returns
経過時間 [ミリ秒]

◆ ms64()

int64 s3d::Stopwatch::ms64 ( ) const

経過時間を [ミリ秒] で返します。

Returns
経過時間 [ミリ秒]

◆ msF()

double s3d::Stopwatch::msF ( ) const

経過時間を [ミリ秒] で返します。

Returns
経過時間 [ミリ秒]

◆ pause()

void s3d::Stopwatch::pause ( )

開始しているストップウォッチを一時停止します。

◆ reset()

void s3d::Stopwatch::reset ( )
noexcept

ストップウォッチを停止し、経過時間を 0 にリセットします。

◆ restart()

void s3d::Stopwatch::restart ( )

経過時間を 0 にリセットして、ストップウォッチを再び開始します。

◆ resume()

void s3d::Stopwatch::resume ( )

ストップウォッチが一時停止中である場合、再開します。

◆ s()

int32 s3d::Stopwatch::s ( ) const

経過時間を [秒] で返します。

Returns
経過時間 [秒]

◆ s64()

int64 s3d::Stopwatch::s64 ( ) const

経過時間を [秒] で返します。

Returns
経過時間 [秒]

◆ set()

void s3d::Stopwatch::set ( const Duration time)

ストップウォッチの経過時間を変更します。

Parameters
time新しく設定する経過時間
Remarks
指定した時間だけ経過している状態にします。計測中であるかの状態は引き継がれます。

◆ sF()

double s3d::Stopwatch::sF ( ) const

経過時間を [秒] で返します。

Returns
経過時間 [秒]

◆ start()

void s3d::Stopwatch::start ( )

ストップウォッチを開始・再開します。

◆ us()

int64 s3d::Stopwatch::us ( ) const

経過時間を [マイクロ秒] で返します。

Returns
経過時間 [マイクロ秒]

◆ us64()

int64 s3d::Stopwatch::us64 ( ) const

経過時間を [マイクロ秒] で返します。

Returns
経過時間 [マイクロ秒]

◆ usF()

double s3d::Stopwatch::usF ( ) const

経過時間を [マイクロ秒] で返します。

Returns
経過時間 [マイクロ秒]

Friends And Related Function Documentation

◆ Formatter

void Formatter ( FormatData formatData,
const Stopwatch value 
)
friend
Parameters
formatData
value

◆ operator< [1/2]

bool operator< ( const MicrosecondsF time,
const Stopwatch s 
)
friend

経過時間を比較します。

Parameters
time比較する時間
sストップウォッチ
Returns
比較の結果

◆ operator< [2/2]

bool operator< ( const Stopwatch s,
const MicrosecondsF time 
)
friend

経過時間を比較します。

Parameters
sストップウォッチ
time比較する時間
Returns
比較の結果

◆ operator<<

template<class CharType >
std::basic_ostream<CharType>& operator<< ( std::basic_ostream< CharType > &  output,
const Stopwatch value 
)
friend
Template Parameters
CharType
Parameters
output
value
Returns

◆ operator<= [1/2]

bool operator<= ( const MicrosecondsF time,
const Stopwatch s 
)
friend

経過時間を比較します。

Parameters
time比較する時間
sストップウォッチ
Returns
比較の結果

◆ operator<= [2/2]

bool operator<= ( const Stopwatch s,
const MicrosecondsF time 
)
friend

経過時間を比較します。

Parameters
sストップウォッチ
time比較する時間
Returns
比較の結果

◆ operator> [1/2]

bool operator> ( const MicrosecondsF time,
const Stopwatch s 
)
friend

経過時間を比較します。

Parameters
time比較する時間
sストップウォッチ
Returns
比較の結果

◆ operator> [2/2]

bool operator> ( const Stopwatch s,
const MicrosecondsF time 
)
friend

経過時間を比較します。

Parameters
sストップウォッチ
time比較する時間
Returns
比較の結果

◆ operator>= [1/2]

bool operator>= ( const MicrosecondsF time,
const Stopwatch s 
)
friend

経過時間を比較します。

Parameters
time比較する時間
sストップウォッチ
Returns
比較の結果

◆ operator>= [2/2]

bool operator>= ( const Stopwatch s,
const MicrosecondsF time 
)
friend

経過時間を比較します。

Parameters
sストップウォッチ
time比較する時間
Returns
比較の結果

The documentation for this class was generated from the following file: