summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-01-23 14:47:17 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-01-25 15:11:18 +0200
commit2f86467586706d254fcbcb1c88657992214aefcd (patch)
tree97c34a7c1589ba32cc981b47792983d057c3b996 /src
parentcc47da5a15650c3f8ede9f7e253e4099dc61673f (diff)
downloadqtlocation-mapboxgl-2f86467586706d254fcbcb1c88657992214aefcd.tar.gz
Cleanup std::chrono usage
Use mbgl::Duration and mbgl::{,Milli}Seconds whenever possible.
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/map/map_data.hpp2
-rw-r--r--src/mbgl/map/transform.cpp4
-rw-r--r--src/mbgl/style/function.cpp1
-rw-r--r--src/mbgl/style/property_parsing.cpp4
-rw-r--r--src/mbgl/util/stopwatch.cpp1
5 files changed, 7 insertions, 5 deletions
diff --git a/src/mbgl/map/map_data.hpp b/src/mbgl/map/map_data.hpp
index 97d16b1c21..67c66896e3 100644
--- a/src/mbgl/map/map_data.hpp
+++ b/src/mbgl/map/map_data.hpp
@@ -26,7 +26,7 @@ public:
, pixelRatio(pixelRatio_)
, annotationManager(pixelRatio)
, animationTime(Duration::zero())
- , defaultFadeDuration(mode_ == MapMode::Continuous ? std::chrono::milliseconds(300) : Duration::zero())
+ , defaultFadeDuration(mode_ == MapMode::Continuous ? Milliseconds(300) : Duration::zero())
, defaultTransitionDuration(Duration::zero())
, defaultTransitionDelay(Duration::zero()) {
assert(pixelRatio > 0);
diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp
index 6ec387ac23..b4743c0719 100644
--- a/src/mbgl/map/transform.cpp
+++ b/src/mbgl/map/transform.cpp
@@ -9,6 +9,7 @@
#include <mbgl/util/tile_coordinate.hpp>
#include <mbgl/platform/log.hpp>
#include <mbgl/platform/platform.hpp>
+#include <mbgl/util/chrono.hpp>
#include <cstdio>
#include <cmath>
@@ -281,8 +282,7 @@ void Transform::flyTo(const CameraOptions &camera, const AnimationOptions &anima
if (animation.velocity) {
velocity = *animation.velocity / rho;
}
- duration = std::chrono::duration_cast<std::chrono::steady_clock::duration>(
- std::chrono::duration<double, std::chrono::seconds::period>(S / velocity));
+ duration = std::chrono::duration_cast<Duration>(std::chrono::duration<double>(S / velocity));
}
if (duration == Duration::zero()) {
// Perform an instantaneous transition.
diff --git a/src/mbgl/style/function.cpp b/src/mbgl/style/function.cpp
index a106b8c557..16af9c8fc8 100644
--- a/src/mbgl/style/function.cpp
+++ b/src/mbgl/style/function.cpp
@@ -1,6 +1,7 @@
#include <mbgl/style/function.hpp>
#include <mbgl/style/style_calculation_parameters.hpp>
#include <mbgl/util/interpolate.hpp>
+#include <mbgl/util/chrono.hpp>
#include <cmath>
diff --git a/src/mbgl/style/property_parsing.cpp b/src/mbgl/style/property_parsing.cpp
index aaf46f0382..bdeb04c286 100644
--- a/src/mbgl/style/property_parsing.cpp
+++ b/src/mbgl/style/property_parsing.cpp
@@ -214,11 +214,11 @@ optional<PropertyTransition> parseProperty(const char *, const JSValue& value) {
if (value.IsObject()) {
bool parsed = false;
if (value.HasMember("duration") && value["duration"].IsNumber()) {
- transition.duration = Duration(std::chrono::milliseconds(value["duration"].GetUint()));
+ transition.duration.emplace(Milliseconds(value["duration"].GetUint()));
parsed = true;
}
if (value.HasMember("delay") && value["delay"].IsNumber()) {
- transition.delay = Duration(std::chrono::milliseconds(value["delay"].GetUint()));
+ transition.delay.emplace(Milliseconds(value["delay"].GetUint()));
parsed = true;
}
if (!parsed) {
diff --git a/src/mbgl/util/stopwatch.cpp b/src/mbgl/util/stopwatch.cpp
index 77779338ae..bbc6bfba0c 100644
--- a/src/mbgl/util/stopwatch.cpp
+++ b/src/mbgl/util/stopwatch.cpp
@@ -1,6 +1,7 @@
#ifndef DISABLE_STOPWATCH
#include <mbgl/util/stopwatch.hpp>
#include <mbgl/util/string.hpp>
+#include <mbgl/util/chrono.hpp>
#include <mbgl/platform/log.hpp>
#include <iostream>