clock.h
Go to the documentation of this file.
/*
* Copyright © 2012-2013 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3,
* as published by the Free Software Foundation.
*
* 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/>.
*
* Authored by: Thomas Voß <thomas.voss@canonical.com>
*/
#ifndef LOCATION_SERVICE_COM_LOMIRI_LOCATION_CLOCK_H_
#define LOCATION_SERVICE_COM_LOMIRI_LOCATION_CLOCK_H_
#include <chrono>
namespace com
{
namespace lomiri
{
namespace location
{
struct Clock
{
typedef std::chrono::high_resolution_clock Type;
typedef std::chrono::high_resolution_clock::duration Duration;
typedef std::chrono::high_resolution_clock::time_point Timestamp;
static inline Timestamp now()
{
return std::chrono::high_resolution_clock::now();
}
static inline Timestamp beginning_of_time()
{
return std::chrono::high_resolution_clock::time_point::min();
}
};
}
}
}
#endif // LOCATION_SERVICE_COM_LOMIRI_LOCATION_CLOCK_H_
com::lomiri::location
Definition accuracy.h:28
com::lomiri
Definition accuracy.h:26
com
Definition accuracy.h:24
com::lomiri::location::Clock
Defines the timebase of the location service.
Definition clock.h:33
com::lomiri::location::Clock::now
static Timestamp now()
Samples a timestamp from the clock.
Definition clock.h:51
com::lomiri::location::Clock::Timestamp
std::chrono::high_resolution_clock::time_point Timestamp
Timestamp type of the location service clock.
Definition clock.h:45
com::lomiri::location::Clock::beginning_of_time
static Timestamp beginning_of_time()
Samples a timestamp from the clock.
Definition clock.h:60
com::lomiri::location::Clock::Duration
std::chrono::high_resolution_clock::duration Duration
Duration type of the location service clock.
Definition clock.h:40
com::lomiri::location::Clock::Type
std::chrono::high_resolution_clock Type
The underlying clock we are assuming for all time-stamping purposes.
Definition clock.h:35