diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-12-04 18:29:42 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-12-04 20:02:50 +0100 |
commit | abafb52f37beb5659efc2105ccd1568e1f754898 (patch) | |
tree | 6a60636d3497560ca61e5aae5f6d7061c4f18553 /src/mbgl/storage/response.cpp | |
parent | bff6aeb4da41dee1f5f1cfa0be81b6c257257253 (diff) | |
download | qtlocation-mapboxgl-abafb52f37beb5659efc2105ccd1568e1f754898.tar.gz |
make most headers private
Diffstat (limited to 'src/mbgl/storage/response.cpp')
-rw-r--r-- | src/mbgl/storage/response.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mbgl/storage/response.cpp b/src/mbgl/storage/response.cpp new file mode 100644 index 0000000000..a08a6d31ce --- /dev/null +++ b/src/mbgl/storage/response.cpp @@ -0,0 +1,22 @@ +#include <mbgl/storage/response.hpp> + +#include <chrono> + +namespace mbgl { + +int64_t Response::parseCacheControl(const char *value) { + if (value) { + unsigned long long seconds = 0; + // TODO: cache-control may contain other information as well: + // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 + if (std::sscanf(value, "max-age=%llu", &seconds) == 1) { + return std::chrono::duration_cast<std::chrono::seconds>( + std::chrono::system_clock::now().time_since_epoch()).count() + + seconds; + } + } + + return -1; +} + +} |