std::string_view 的使用
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <string_view>
|
||||
|
||||
using Func_Type = void (*)(MLAT_Data *buf, std::uint16_t *len);
|
||||
Func_Type read_func_ptr{};
|
||||
@@ -28,7 +29,7 @@ double lat = 121.473701;
|
||||
//
|
||||
// *len = 1;
|
||||
// }
|
||||
time_t datetime_to_timestamp(const std::string &datetime) {
|
||||
time_t datetime_to_timestamp(std::string_view datetime) {
|
||||
std::tm tm = {};
|
||||
std::istringstream ss(datetime);
|
||||
ss >> std::get_time(&tm, "%Y-%m-%d %H:%M:%S");
|
||||
|
||||
Reference in New Issue
Block a user