PIMathVectorT subvector methods PISystemTime::isNull() PISystemTime::Frequency::isNull() PISystemTime::toString() PISystemTime::fromString() PIVariant can handle strings with PISystemTime PIDateTime::toSystemTime() now returns null time from invalid strings
191 lines
5.5 KiB
C
191 lines
5.5 KiB
C
/*! \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 days
|
|
//! \~russian PISystemTime из дней
|
|
inline PISystemTime operator""_d(long double v) {
|
|
return PISystemTime::fromSeconds(v * 60. * 60. * 24.);
|
|
}
|
|
|
|
//! \~\brief
|
|
//! \~english PISystemTime from days
|
|
//! \~russian PISystemTime из дней
|
|
inline PISystemTime operator""_d(unsigned long long v) {
|
|
return PISystemTime::fromSeconds(v * 60. * 60. * 24.);
|
|
}
|
|
|
|
|
|
//! \~\brief
|
|
//! \~english PISystemTime from hours
|
|
//! \~russian PISystemTime из часов
|
|
inline PISystemTime operator""_h(long double v) {
|
|
return PISystemTime::fromSeconds(v * 60. * 60.);
|
|
}
|
|
|
|
//! \~\brief
|
|
//! \~english PISystemTime from hours
|
|
//! \~russian PISystemTime из часов
|
|
inline PISystemTime operator""_h(unsigned long long v) {
|
|
return PISystemTime::fromSeconds(v * 60. * 60.);
|
|
}
|
|
|
|
|
|
//! \~\brief
|
|
//! \~english PISystemTime from minutes
|
|
//! \~russian PISystemTime из минут
|
|
inline PISystemTime operator""_m(long double v) {
|
|
return PISystemTime::fromSeconds(v * 60.);
|
|
}
|
|
|
|
//! \~\brief
|
|
//! \~english PISystemTime from minutes
|
|
//! \~russian PISystemTime из минут
|
|
inline PISystemTime operator""_m(unsigned long long v) {
|
|
return PISystemTime::fromSeconds(v * 60.);
|
|
}
|
|
|
|
|
|
//! \~\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);
|
|
}
|
|
|
|
|
|
//! \~\brief
|
|
//! \~english PISystemTime::Frequency from hertz
|
|
//! \~russian PISystemTime::Frequency из герц
|
|
inline PISystemTime::Frequency operator""_Hz(long double v) {
|
|
return PISystemTime::Frequency::fromHertz(v);
|
|
}
|
|
|
|
//! \~\brief
|
|
//! \~english PISystemTime::Frequency from hertz
|
|
//! \~russian PISystemTime::Frequency из герц
|
|
inline PISystemTime::Frequency operator""_Hz(unsigned long long v) {
|
|
return PISystemTime::Frequency::fromHertz(v);
|
|
}
|
|
|
|
|
|
//! \~\brief
|
|
//! \~english PISystemTime::Frequency from kilohertz
|
|
//! \~russian PISystemTime::Frequency из килогерц
|
|
inline PISystemTime::Frequency operator""_KHz(long double v) {
|
|
return PISystemTime::Frequency::fromKHertz(v);
|
|
}
|
|
|
|
//! \~\brief
|
|
//! \~english PISystemTime::Frequency from kilohertz
|
|
//! \~russian PISystemTime::Frequency из килогерц
|
|
inline PISystemTime::Frequency operator""_KHz(unsigned long long v) {
|
|
return PISystemTime::Frequency::fromKHertz(v);
|
|
}
|
|
|
|
|
|
//! \~\brief
|
|
//! \~english PISystemTime::Frequency from megahertz
|
|
//! \~russian PISystemTime::Frequency из мегагерц
|
|
inline PISystemTime::Frequency operator""_MHz(long double v) {
|
|
return PISystemTime::Frequency::fromMHertz(v);
|
|
}
|
|
|
|
//! \~\brief
|
|
//! \~english PISystemTime::Frequency from megahertz
|
|
//! \~russian PISystemTime::Frequency из мегагерц
|
|
inline PISystemTime::Frequency operator""_MHz(unsigned long long v) {
|
|
return PISystemTime::Frequency::fromMHertz(v);
|
|
}
|
|
|
|
|
|
//! \~\brief
|
|
//! \~english PISystemTime::Frequency from gigahertz
|
|
//! \~russian PISystemTime::Frequency из гигагерц
|
|
inline PISystemTime::Frequency operator""_GHz(long double v) {
|
|
return PISystemTime::Frequency::fromGHertz(v);
|
|
}
|
|
|
|
//! \~\brief
|
|
//! \~english PISystemTime::Frequency from gigahertz
|
|
//! \~russian PISystemTime::Frequency из гигагерц
|
|
inline PISystemTime::Frequency operator""_GHz(unsigned long long v) {
|
|
return PISystemTime::Frequency::fromGHertz(v);
|
|
}
|
|
|
|
|
|
#endif
|