History

TimeSeriesPlatformLibrary: Added temporal support options to DataPublisher interfaces.

J. Ritchie Carroll committed 7 years ago

Commit 5c5b4061 parent 04505f228 files · +603 −300Browse files

Showing the changes to Source/Libraries/TimeSeriesPlatformLibrary/Common/Convert.h (1 of 28 files). Show all

Unified · Split

Source/Libraries/TimeSeriesPlatformLibrary/Common/Convert.h+12−8
@@ -32,18 +32,18 @@ namespace GSF · 31 unmodified lines
3232 void ToUnixTime(int64_t ticks, time_t& unixSOC, uint16_t& milliseconds);
3333
3434 // Convert Unix second of century and milliseconds to DateTime
35− DateTime FromUnixTime(time_t unixSOC, uint16_t milliseconds);
35+ datetime_t FromUnixTime(time_t unixSOC, uint16_t milliseconds);
3636
3737 // Converts a timestamp, in Ticks, to DateTime
38− DateTime FromTicks(int64_t ticks);
38+ datetime_t FromTicks(int64_t ticks);
3939
4040 // Converts a DateTime to Ticks
41− int64_t ToTicks(const DateTime& time);
41+ int64_t ToTicks(const datetime_t& time);
4242
4343 // Thin wrapper around strftime to provide formats for milliseconds (%f) and full-resolution ticks (%t)
4444 uint32_t TicksToString(char* ptr, uint32_t maxsize, std::string format, int64_t ticks);
4545
46− DateTime LocalFromUtc(const DateTime& timestamp);
46+ datetime_t LocalFromUtc(const datetime_t& timestamp);
4747
4848 // Converts an object to a string
4949 template<class T>
@@ -56,7 +56,7 @@ namespace GSF · 6 unmodified lines
5656
5757 std::string ToString(const Guid& value);
5858
59− std::string ToString(const DateTime& value, const char* format = "%Y-%m-%d %H:%M:%S%F");
59+ std::string ToString(const datetime_t& value, const char* format = "%Y-%m-%d %H:%M:%S%F");
6060
6161 std::string ToString(const TimeSpan& value);
6262
@@ -74,7 +74,11 @@ namespace GSF · 11 unmodified lines
7474
7575 bool ParseBoolean(const std::string& value);
7676
77− bool TryParseDouble(const std::string& value, float64_t& result);
77+ bool TryParseInt32(const std::string& value, int32_t& result, int32_t defaultValue = 0);
78+
79+ bool TryParseInt64(const std::string& value, int64_t& result, int64_t defaultValue = 0L);
80+
81+ bool TryParseDouble(const std::string& value, float64_t& result, float64_t defaultValue = 0.0);
7882
7983 // Encodes a character value into an escaped RegEx value
8084 std::string RegExEncode(char value);
@@ -88,10 +92,10 @@ namespace GSF · 7 unmodified lines
8892 const char* Coalesce(const char* data, const char* nonEmptyValue);
8993
9094 // Attempts to parse an time string in several common formats
91− bool TryParseTimestamp(const char* time, DateTime& timestamp, bool parseAsUTC = true);
95+ bool TryParseTimestamp(const char* time, datetime_t& timestamp, const datetime_t& defaultValue = DateTime::MinValue, bool parseAsUTC = true);
9296
9397 // Converts a string to a date-time that may be in several common formats
94− DateTime ParseTimestamp(const char* time, bool parseAsUTC = true);
98+ datetime_t ParseTimestamp(const char* time, bool parseAsUTC = true);
9599
96100 // Parses a string of key/value pairs into a case-insensitive string dictionary
97101 StringMap<std::string> ParseKeyValuePairs(const std::string& value, char parameterDelimiter = ';', char keyValueDelimiter = '=', char startValueDelimiter = '{', char endValueDelimiter = '}');

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t