ubuntu-location-service: /build/location-service-git/src/location-service/include/location_service/com/ubuntu/location/clock.h Source File

ubuntu-location-service .. An aggregating location service providing positioning and geocoding capabilities to applications.

clock.h
Go to the documentation of this file.
1 /*
2 * Copyright © 2012-2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Thomas Voß <thomas.voss@canonical.com>
17 */
18 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_CLOCK_H_
19 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_CLOCK_H_
20
21 #include <chrono>
22
23 namespace com
24 {
25 namespace ubuntu
26 {
27 namespace location
28 {
32 struct Clock
33 {
35 typedef std::chrono::high_resolution_clock Type;
36
40 typedef std::chrono::high_resolution_clock::duration Duration;
41
45 typedef std::chrono::high_resolution_clock::time_point Timestamp;
46
51 static inline Timestamp now()
52 {
53 return std::chrono::high_resolution_clock::now();
54 }
55
60 static inline Timestamp beginning_of_time()
61 {
62 return std::chrono::high_resolution_clock::time_point::min();
63 }
64 };
65 }
66 }
67 }
68
69 #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_CLOCK_H_
com
Definition: accuracy.h:24
com::ubuntu::location::Clock
Defines the timebase of the location service.
Definition: clock.h:33
com::ubuntu::location::Clock::Timestamp
std::chrono::high_resolution_clock::time_point Timestamp
Timestamp type of the location service clock.
Definition: clock.h:45
com::ubuntu::location::Clock::now
static Timestamp now()
Samples a timestamp from the clock.
Definition: clock.h:51
com::ubuntu::location::Clock::Duration
std::chrono::high_resolution_clock::duration Duration
Duration type of the location service clock.
Definition: clock.h:40
com::ubuntu::location::Clock::beginning_of_time
static Timestamp beginning_of_time()
Samples a timestamp from the clock.
Definition: clock.h:60
com::ubuntu::location::Clock::Type
std::chrono::high_resolution_clock Type
The underlying clock we are assuming for all time-stamping purposes.
Definition: clock.h:35