diff options
author | DarkByt31 <avihs.29@gmail.com> | 2019-09-06 15:26:30 +0530 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2019-09-06 13:25:41 +0200 |
commit | 8aea22a32b28728033c4f06a79f93e63b1322151 (patch) | |
tree | 468b701aba33fb6f8e0a026eface53a845e00e1c | |
parent | android: add support for screen dimming from JS. (diff) | |
download | online-8aea22a32b28728033c4f06a79f93e63b1322151.tar.gz online-8aea22a32b28728033c4f06a79f93e63b1322151.zip |
tdf#107038 Poco::Timestamp replacement with std::chrono
Replaced Poco::DateTimeFormatter with Util::getHttpTimeNow
Change-Id: I1a8591a434140270929406386218d08c71a888cc
Reviewed-on: https://gerrit.libreoffice.org/78700
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r-- | net/Socket.cpp | 2 | ||||
-rw-r--r-- | tools/WebSocketDump.cpp | 2 | ||||
-rw-r--r-- | wsd/LOOLWSD.cpp | 4 | ||||
-rw-r--r-- | wsd/TraceFile.hpp | 6 |
4 files changed, 8 insertions, 6 deletions
diff --git a/net/Socket.cpp b/net/Socket.cpp index cb5043414c..f5661c3dde 100644 --- a/net/Socket.cpp +++ b/net/Socket.cpp @@ -415,7 +415,7 @@ void StreamSocket::dumpState(std::ostream& os) void StreamSocket::send(Poco::Net::HTTPResponse& response) { response.set("User-Agent", HTTP_AGENT_STRING); - response.set("Date", Poco::DateTimeFormatter::format(Poco::Timestamp(), Poco::DateTimeFormat::HTTP_FORMAT)); + response.set("Date", Util::getHttpTimeNow()); std::ostringstream oss; response.write(oss); diff --git a/tools/WebSocketDump.cpp b/tools/WebSocketDump.cpp index 39212b7e0a..e7fe148008 100644 --- a/tools/WebSocketDump.cpp +++ b/tools/WebSocketDump.cpp @@ -161,7 +161,7 @@ private: // Bad request. std::ostringstream oss; oss << "HTTP/1.1 400\r\n" - << "Date: " << Poco::DateTimeFormatter::format(Poco::Timestamp(), Poco::DateTimeFormat::HTTP_FORMAT) << "\r\n" + << "Date: " << Util::getHttpTimeNow() << "\r\n" << "User-Agent: LOOLWSD WOPI Agent\r\n" << "Content-Length: 0\r\n" << "\r\n"; diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index 5a1dbce411..f84a732384 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -2438,7 +2438,7 @@ private: // Bad request. std::ostringstream oss; oss << "HTTP/1.1 400\r\n" - << "Date: " << Poco::DateTimeFormatter::format(Poco::Timestamp(), Poco::DateTimeFormat::HTTP_FORMAT) << "\r\n" + << "Date: " << Util::getHttpTimeNow() << "\r\n" << "User-Agent: LOOLWSD WOPI Agent\r\n" << "Content-Length: 0\r\n" << "\r\n" @@ -2740,7 +2740,7 @@ private: LOG_ERR("Download file [" << filePathAnonym << "] not found."); std::ostringstream oss; oss << "HTTP/1.1 404 Not Found\r\n" - << "Date: " << Poco::DateTimeFormatter::format(Poco::Timestamp(), Poco::DateTimeFormat::HTTP_FORMAT) << "\r\n" + << "Date: " << Util::getHttpTimeNow() << "\r\n" << "User-Agent: " << HTTP_AGENT_STRING << "\r\n" << "Content-Length: 0\r\n" << "\r\n"; diff --git a/wsd/TraceFile.hpp b/wsd/TraceFile.hpp index 5f3ac72025..82f5a75ce8 100644 --- a/wsd/TraceFile.hpp +++ b/wsd/TraceFile.hpp @@ -91,7 +91,8 @@ public: const bool compress, const bool takeSnapshot, const std::vector<std::string>& filters) : - _epochStart(Poco::Timestamp().epochMicroseconds()), + _epochStart(std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now() + .time_since_epoch()).count()), _recordOutgoing(recordOugoing), _compress(compress), _takeSnapshot(takeSnapshot), @@ -258,7 +259,8 @@ private: { Util::assertIsLocked(_mutex); - const Poco::Int64 usec = Poco::Timestamp().epochMicroseconds() - _epochStart; + const Poco::Int64 usec = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono + ::system_clock::now().time_since_epoch()).count() - _epochStart; if (_compress) { _deflater.write(&delim, 1); |