summaryrefslogtreecommitdiff
path: root/include/mbgl/util
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-01-19 18:32:33 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-01-22 18:41:54 -0800
commitcef5c331fe6ab827e71aed1e4e0387983083c88e (patch)
tree47c71da0e81f25678640032d5708212ef022072e /include/mbgl/util
parent5cd123422ed026912c53c44a393f141f990a09df (diff)
downloadqtlocation-mapboxgl-cef5c331fe6ab827e71aed1e4e0387983083c88e.tar.gz
[core] Merge rfc1123, iso8601, and parse_date into chrono.hpp and fix their API
Diffstat (limited to 'include/mbgl/util')
-rw-r--r--include/mbgl/util/chrono.hpp13
-rw-r--r--include/mbgl/util/parsedate.h38
-rw-r--r--include/mbgl/util/time.hpp24
3 files changed, 13 insertions, 62 deletions
diff --git a/include/mbgl/util/chrono.hpp b/include/mbgl/util/chrono.hpp
index ce005485bc..dd228df977 100644
--- a/include/mbgl/util/chrono.hpp
+++ b/include/mbgl/util/chrono.hpp
@@ -2,6 +2,7 @@
#define MBGL_UTIL_CHRONO
#include <chrono>
+#include <string>
namespace mbgl {
@@ -42,6 +43,18 @@ Milliseconds toMilliseconds(std::chrono::time_point<_Clock, _Duration> time_poin
return asMilliseconds(toDuration<_Clock, _Duration>(time_point));
}
+namespace util {
+
+// Returns the RFC1123 formatted date. E.g. "Tue, 04 Nov 2014 02:13:24 GMT"
+std::string rfc1123(SystemTimePoint);
+
+// YYYY-mm-dd HH:MM:SS e.g. "2015-11-26 16:11:23"
+std::string iso8601(SystemTimePoint);
+
+SystemTimePoint parseTimePoint(const char *);
+
+} // namespace util
+
} // namespace mbgl
#endif
diff --git a/include/mbgl/util/parsedate.h b/include/mbgl/util/parsedate.h
deleted file mode 100644
index 6905e361d4..0000000000
--- a/include/mbgl/util/parsedate.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef HEADER_PARSEDATE_H
-#define HEADER_PARSEDATE_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at http://curl.haxx.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ***************************************************************************/
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <time.h>
-
-time_t parse_date(const char *p);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* HEADER_PARSEDATE_H */
diff --git a/include/mbgl/util/time.hpp b/include/mbgl/util/time.hpp
deleted file mode 100644
index 181c961ab2..0000000000
--- a/include/mbgl/util/time.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef MBGL_UTIL_TIME
-#define MBGL_UTIL_TIME
-
-#include <mbgl/util/chrono.hpp>
-
-#include <string>
-#include <cstdint>
-#include <ctime>
-
-namespace mbgl {
-
-namespace util {
-
-// Returns the RFC1123 formatted date. E.g. "Tue, 04 Nov 2014 02:13:24 GMT"
-std::string rfc1123(std::time_t time);
-
-// YYYY-mm-dd HH:MM:SS e.g. "2015-11-26 16:11:23"
-std::string iso8601(std::time_t time);
-
-} // namespace util
-
-} // namespace mbgl
-
-#endif