This commit is contained in:
peri4
2022-03-21 22:03:47 +03:00
parent 20e0771331
commit 9a8b9c7141
7 changed files with 404 additions and 149 deletions

View File

@@ -39,31 +39,73 @@
# include <sys/time.h>
#endif
/*! \class PISystemTime
* \brief System time
*
* \section PISystemTime_sec0 Synopsis
* This class provide arithmetic functions for POSIX system time.
* This time represents as seconds and nanosecons in integer formats.
* You can take current system time with function \a PISystemTime::current(),
* compare times, sum or subtract two times, convert time to/from
* seconds, milliseconds, microseconds or nanoseconds.
* \section PISystemTime_sec1 Example
* \snippet pitimer.cpp system_time
*/
//! \addtogroup Core
//! \{
//! \class PISystemTime pitime.h
//! \brief
//! \~english System time with nanosecond precision
//! \~russian Системное время с точностью до наносекунд
//!
//! \~english \section PISystemTime_sec0 Synopsis
//! \~russian \section PISystemTime_sec0 Краткий обзор
//! \~english
//! This class provide arithmetic functions for POSIX system time.
//! This time represents as seconds and nanosecons in integer formats.
//! You can take current system time with function \a PISystemTime::current(),
//! compare times, sum or subtract two times, convert time to/from
//! seconds, milliseconds, microseconds or nanoseconds.
//!
//! \~russian
//! Этот класс предоставляет арифметику для системного времени в формате POSIX.
//! Это время представлено в виде целочисленных секунд и наносекунд.
//! Можно взять текущее время с помощью метода \a PISystemTime::current(),
//! сравнивать, суммировать и вычитать времена, преобразовывать в/из
//! секунд, миллисекунд, микросекунд и наносекунд.
//!
//! \~english \section PISystemTime_sec1 Example
//! \~russian \section PISystemTime_sec1 Пример
//! \~\snippet pitimer.cpp system_time
//!
//! \}
/*! \class PITimeMeasurer
* \brief Time measurements
*
* \section PITimeMeasurer_sec0 Synopsis
* Function \a reset() set time mark to current
* system time, then functions double elapsed_*() returns time elapsed from this mark.
* These functions can returns nano-, micro-, milli- and seconds with suffixes "n", "u", "m"
* and "s"
*/
//! \addtogroup Core
//! \{
//! \class PITimeMeasurer pitime.h
//! \brief
//! \~english Time measurements
//! \~russian Измерение времени
//!
//! \~english \section PITimeMeasurer_sec0 Usage
//! \~russian \section PITimeMeasurer_sec0 Использование
//! \~english
//! Function \a reset() set time mark to current
//! system time, then functions "double elapsed_*()" returns time elapsed from this mark.
//! These functions can returns nano-, micro-, milli- and seconds with suffixes "n", "u", "m"
//! and "s"
//!
//! \~russian
//! Метод \a reset() устанавливает текущую метку системного времени. Далее методы
//! "double elapsed_*()" возвращают время, прошедшее от установленной метки.
//! Эти методы возвращают нано, микро, милли и секунды с приставками
//! "n", "u", "m" и "s".
//!
//! \}
//! \details
//! \~english
//! This function consider \c "usleep" offset
//! on QNX/Linux/Mac, which is calculated with
//! \a pip_sys_test program. If this is correct
//! offset value in system config, this function
//! wait \b exactly "usecs" microseconds.
//! \~russian
//! Этот метод учитывает смещение \c "usleep"
//! на QNX/Linux/Mac, которое расчитывается с помощью
//! утилиты \a pip_sys_test. Если это значение в системном
//! конфиге действительно, то этот метод будет ожидать
//! \b точно "usecs" микросекунд.
void piUSleep(int usecs) {
if (usecs <= 0) return;
#ifdef WINDOWS