summaryrefslogtreecommitdiff
path: root/src/mbgl/util
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2015-11-25 13:30:32 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2015-11-27 17:47:02 +0200
commit31fd2822f516337f084f85db7e369d0633113b73 (patch)
tree9ad07f1bc0b3924f225ecfc628955bbd683e1d99 /src/mbgl/util
parent4475f5486000bab8f1121f5cec6091bc04f165f1 (diff)
downloadqtlocation-mapboxgl-31fd2822f516337f084f85db7e369d0633113b73.tar.gz
[core] Replace time_t with std::chrono::seconds
Added aliases for std::chrono typedefs (eg. 'Seconds' for std::chrono::seconds). These aliases are used together with templated helper functions to replace time_t with std::chrono::seconds for most cases, in particular for 'modified' and 'expires' values in Response.
Diffstat (limited to 'src/mbgl/util')
-rw-r--r--src/mbgl/util/chrono.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mbgl/util/chrono.cpp b/src/mbgl/util/chrono.cpp
new file mode 100644
index 0000000000..4102092a90
--- /dev/null
+++ b/src/mbgl/util/chrono.cpp
@@ -0,0 +1,20 @@
+#include <mbgl/util/chrono.hpp>
+
+namespace mbgl {
+
+template Duration toDuration<Clock, Duration>(TimePoint);
+template SystemDuration toDuration<SystemClock, SystemDuration>(SystemTimePoint);
+
+template Seconds asSeconds<Duration>(Duration);
+template Seconds asSeconds<Milliseconds>(Milliseconds);
+
+template Seconds toSeconds<Clock, Duration>(TimePoint);
+template Seconds toSeconds<SystemClock, SystemDuration>(SystemTimePoint);
+
+template Milliseconds asMilliseconds<Duration>(Duration);
+template Milliseconds asMilliseconds<Seconds>(Seconds);
+
+template Milliseconds toMilliseconds<Clock, Duration>(TimePoint);
+template Milliseconds toMilliseconds<SystemClock, SystemDuration>(SystemTimePoint);
+
+}