mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 21:20:06 +00:00
Time and integer parsing
This commit is contained in:
parent
c8d8b24317
commit
2cd76d7da4
4 changed files with 62 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
|
@ -29,5 +30,8 @@ std::vector<std::string> ParseTokens(const std::string& s,
|
|||
|
||||
std::string ToString(const std::vector<std::string>& v);
|
||||
|
||||
template<typename T>
|
||||
std::optional<T> TryParseUnsignedLong(const std::string& str);
|
||||
|
||||
} // namespace util
|
||||
} // namespace scwx
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include <optional>
|
||||
|
||||
#if !defined(_MSC_VER)
|
||||
# include <date/tz.h>
|
||||
|
|
@ -24,5 +25,9 @@ std::string TimeString(std::chrono::system_clock::time_point time,
|
|||
const time_zone* timeZone = nullptr,
|
||||
bool epochValid = true);
|
||||
|
||||
template<typename T>
|
||||
std::optional<std::chrono::sys_time<T>>
|
||||
TryParseDateTime(const std::string& dateTimeFormat, const std::string& str);
|
||||
|
||||
} // namespace util
|
||||
} // namespace scwx
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue