[core] Merge rfc1123, iso8601, and parse_date into chrono.hpp and fix their API
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user