/*! \file piliterals_time.h
 * \ingroup Core
 * \~\brief
 * \~english PISystemTime and frequency literal operators
 * \~russian Операторы литералов для 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"


//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime from days
//! \~russian PISystemTime из дней
inline PISystemTime operator""_d(long double v) {
	return PISystemTime::fromSeconds(v * 60. * 60. * 24.);
}

//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime from days
//! \~russian PISystemTime из дней
inline PISystemTime operator""_d(unsigned long long v) {
	return PISystemTime::fromSeconds(v * 60. * 60. * 24.);
}


//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime from hours
//! \~russian PISystemTime из часов
inline PISystemTime operator""_h(long double v) {
	return PISystemTime::fromSeconds(v * 60. * 60.);
}

//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime from hours
//! \~russian PISystemTime из часов
inline PISystemTime operator""_h(unsigned long long v) {
	return PISystemTime::fromSeconds(v * 60. * 60.);
}


//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime from minutes
//! \~russian PISystemTime из минут
inline PISystemTime operator""_m(long double v) {
	return PISystemTime::fromSeconds(v * 60.);
}

//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime from minutes
//! \~russian PISystemTime из минут
inline PISystemTime operator""_m(unsigned long long v) {
	return PISystemTime::fromSeconds(v * 60.);
}


//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime from seconds
//! \~russian PISystemTime из секунд
inline PISystemTime operator""_s(long double v) {
	return PISystemTime::fromSeconds(v);
}

//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime from seconds
//! \~russian PISystemTime из секунд
inline PISystemTime operator""_s(unsigned long long v) {
	return PISystemTime::fromSeconds(v);
}


//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime from milliseconds
//! \~russian PISystemTime из миллисекунд
inline PISystemTime operator""_ms(long double v) {
	return PISystemTime::fromMilliseconds(v);
}

//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime from milliseconds
//! \~russian PISystemTime из миллисекунд
inline PISystemTime operator""_ms(unsigned long long v) {
	return PISystemTime::fromMilliseconds(v);
}


//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime from microseconds
//! \~russian PISystemTime из микросекунд
inline PISystemTime operator""_us(long double v) {
	return PISystemTime::fromMicroseconds(v);
}

//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime from microseconds
//! \~russian PISystemTime из микросекунд
inline PISystemTime operator""_us(unsigned long long v) {
	return PISystemTime::fromMicroseconds(v);
}


//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime from nanoseconds
//! \~russian PISystemTime из наносекунд
inline PISystemTime operator""_ns(unsigned long long v) {
	return PISystemTime::fromNanoseconds(v);
}


//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime::Frequency from hertz
//! \~russian PISystemTime::Frequency из герц
inline PISystemTime::Frequency operator""_Hz(long double v) {
	return PISystemTime::Frequency::fromHertz(v);
}

//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime::Frequency from hertz
//! \~russian PISystemTime::Frequency из герц
inline PISystemTime::Frequency operator""_Hz(unsigned long long v) {
	return PISystemTime::Frequency::fromHertz(v);
}


//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime::Frequency from kilohertz
//! \~russian PISystemTime::Frequency из килогерц
inline PISystemTime::Frequency operator""_KHz(long double v) {
	return PISystemTime::Frequency::fromKHertz(v);
}

//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime::Frequency from kilohertz
//! \~russian PISystemTime::Frequency из килогерц
inline PISystemTime::Frequency operator""_KHz(unsigned long long v) {
	return PISystemTime::Frequency::fromKHertz(v);
}


//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime::Frequency from megahertz
//! \~russian PISystemTime::Frequency из мегагерц
inline PISystemTime::Frequency operator""_MHz(long double v) {
	return PISystemTime::Frequency::fromMHertz(v);
}

//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime::Frequency from megahertz
//! \~russian PISystemTime::Frequency из мегагерц
inline PISystemTime::Frequency operator""_MHz(unsigned long long v) {
	return PISystemTime::Frequency::fromMHertz(v);
}


//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime::Frequency from gigahertz
//! \~russian PISystemTime::Frequency из гигагерц
inline PISystemTime::Frequency operator""_GHz(long double v) {
	return PISystemTime::Frequency::fromGHertz(v);
}

//! \~\ingroup Core
//! \~\brief
//! \~english PISystemTime::Frequency from gigahertz
//! \~russian PISystemTime::Frequency из гигагерц
inline PISystemTime::Frequency operator""_GHz(unsigned long long v) {
	return PISystemTime::Frequency::fromGHertz(v);
}


#endif
