summaryrefslogtreecommitdiff
path: root/src/mbgl/util/http_header.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-02-15 17:35:13 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-04-14 14:18:19 -0700
commit3af3e72bb3cb3f05b33be304d59e66cc244ef4d9 (patch)
treeef1d237c3083694307081c219c9da94ae43fe540 /src/mbgl/util/http_header.cpp
parent6d88a23a60bc0a6dc9945bf09a659d15dd827192 (diff)
downloadqtlocation-mapboxgl-3af3e72bb3cb3f05b33be304d59e66cc244ef4d9.tar.gz
[all] Replace HTTPContextBase/HTTPRequestBase with FileSource
Diffstat (limited to 'src/mbgl/util/http_header.cpp')
-rw-r--r--src/mbgl/util/http_header.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mbgl/util/http_header.cpp b/src/mbgl/util/http_header.cpp
index 00aee151c8..cfc43991b7 100644
--- a/src/mbgl/util/http_header.cpp
+++ b/src/mbgl/util/http_header.cpp
@@ -25,5 +25,13 @@ CacheControl CacheControl::parse(const std::string& value) {
return result;
}
+optional<SystemTimePoint> CacheControl::toTimePoint() const {
+ // Round trip through time_t to truncate fractional seconds.
+ return maxAge
+ ? SystemClock::from_time_t(SystemClock::to_time_t(
+ SystemClock::now() + std::chrono::seconds(*maxAge)))
+ : optional<SystemTimePoint>();
+}
+
} // namespace http
} // namespace mbgl