more literals, use some in PIP, small refactor PIThread::start (clang-format mistakes)
This commit is contained in:
85
libs/main/literals/piliterals_time.h
Normal file
85
libs/main/literals/piliterals_time.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/*! \file piliterals_time.h
|
||||
* \ingroup Core
|
||||
* \~\brief
|
||||
* \~english PISystemTime C++11 literals
|
||||
* \~russian C++11 суффиксы PISystemTime
|
||||
*/
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
PISystemTime C++11 literals
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PILITERALS_TIME_H
|
||||
#define PILITERALS_TIME_H
|
||||
|
||||
#include "pisystemtime.h"
|
||||
|
||||
|
||||
//! \~\brief
|
||||
//! \~english PISystemTime from seconds
|
||||
//! \~russian PISystemTime из секунд
|
||||
inline PISystemTime operator""_s(long double v) {
|
||||
return PISystemTime::fromSeconds(v);
|
||||
}
|
||||
|
||||
//! \~\brief
|
||||
//! \~english PISystemTime from seconds
|
||||
//! \~russian PISystemTime из секунд
|
||||
inline PISystemTime operator""_s(unsigned long long v) {
|
||||
return PISystemTime::fromSeconds(v);
|
||||
}
|
||||
|
||||
|
||||
//! \~\brief
|
||||
//! \~english PISystemTime from milliseconds
|
||||
//! \~russian PISystemTime из милисекунд
|
||||
inline PISystemTime operator""_ms(long double v) {
|
||||
return PISystemTime::fromMilliseconds(v);
|
||||
}
|
||||
|
||||
//! \~\brief
|
||||
//! \~english PISystemTime from milliseconds
|
||||
//! \~russian PISystemTime из милисекунд
|
||||
inline PISystemTime operator""_ms(unsigned long long v) {
|
||||
return PISystemTime::fromMilliseconds(v);
|
||||
}
|
||||
|
||||
|
||||
//! \~\brief
|
||||
//! \~english PISystemTime from microseconds
|
||||
//! \~russian PISystemTime из микросекунд
|
||||
inline PISystemTime operator""_us(long double v) {
|
||||
return PISystemTime::fromMicroseconds(v);
|
||||
}
|
||||
|
||||
//! \~\brief
|
||||
//! \~english PISystemTime from microseconds
|
||||
//! \~russian PISystemTime из микросекунд
|
||||
inline PISystemTime operator""_us(unsigned long long v) {
|
||||
return PISystemTime::fromMicroseconds(v);
|
||||
}
|
||||
|
||||
|
||||
//! \~\brief
|
||||
//! \~english PISystemTime from nanoseconds
|
||||
//! \~russian PISystemTime из наносекунд
|
||||
inline PISystemTime operator""_ns(unsigned long long v) {
|
||||
return PISystemTime::fromNanoseconds(v);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user