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
32 void ToUnixTime(int64_t ticks, time_t& unixSOC, uint16_t& milliseconds);32 void ToUnixTime(int64_t ticks, time_t& unixSOC, uint16_t& milliseconds);
33 33
34 // Convert Unix second of century and milliseconds to DateTime34 // 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);
36 36
37 // Converts a timestamp, in Ticks, to DateTime37 // Converts a timestamp, in Ticks, to DateTime
38 DateTime FromTicks(int64_t ticks);38 datetime_t FromTicks(int64_t ticks);
39 39
40 // Converts a DateTime to Ticks40 // Converts a DateTime to Ticks
41 int64_t ToTicks(const DateTime& time);41 int64_t ToTicks(const datetime_t& time);
42 42
43 // Thin wrapper around strftime to provide formats for milliseconds (%f) and full-resolution ticks (%t)43 // Thin wrapper around strftime to provide formats for milliseconds (%f) and full-resolution ticks (%t)
44 uint32_t TicksToString(char* ptr, uint32_t maxsize, std::string format, int64_t ticks);44 uint32_t TicksToString(char* ptr, uint32_t maxsize, std::string format, int64_t ticks);
45 45
46 DateTime LocalFromUtc(const DateTime& timestamp);46 datetime_t LocalFromUtc(const datetime_t& timestamp);
47 47
48 // Converts an object to a string48 // Converts an object to a string
49 template<class T>49 template<class T>
@@ -56,7 +56,7 @@ namespace GSF · 6 unmodified lines
56 56
57 std::string ToString(const Guid& value);57 std::string ToString(const Guid& value);
58 58
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");
60 60
61 std::string ToString(const TimeSpan& value);61 std::string ToString(const TimeSpan& value);
62 62
@@ -74,7 +74,11 @@ namespace GSF · 11 unmodified lines
74 74
75 bool ParseBoolean(const std::string& value);75 bool ParseBoolean(const std::string& value);
76 76
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);
78 82
79 // Encodes a character value into an escaped RegEx value83 // Encodes a character value into an escaped RegEx value
80 std::string RegExEncode(char value);84 std::string RegExEncode(char value);
@@ -88,10 +92,10 @@ namespace GSF · 7 unmodified lines
88 const char* Coalesce(const char* data, const char* nonEmptyValue);92 const char* Coalesce(const char* data, const char* nonEmptyValue);
89 93
90 // Attempts to parse an time string in several common formats94 // 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);
92 96
93 // Converts a string to a date-time that may be in several common formats97 // 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);
95 99
96 // Parses a string of key/value pairs into a case-insensitive string dictionary100 // Parses a string of key/value pairs into a case-insensitive string dictionary
97 StringMap<std::string> ParseKeyValuePairs(const std::string& value, char parameterDelimiter = ';', char keyValueDelimiter = '=', char startValueDelimiter = '{', char endValueDelimiter = '}');101 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