[Libreoffice-commits] online.git: net/Socket.cpp tools/WebSocketDump.cpp wsd/LOOLWSD.cpp wsd/TraceFile.hpp

DarkByt31 (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 6 11:25:59 UTC 2019


 net/Socket.cpp          |    2 +-
 tools/WebSocketDump.cpp |    2 +-
 wsd/LOOLWSD.cpp         |    4 ++--
 wsd/TraceFile.hpp       |    6 ++++--
 4 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 8aea22a32b28728033c4f06a79f93e63b1322151
Author:     DarkByt31 <avihs.29 at gmail.com>
AuthorDate: Fri Sep 6 15:26:30 2019 +0530
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Sep 6 13:25:41 2019 +0200

    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 at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/net/Socket.cpp b/net/Socket.cpp
index cb5043414..f5661c3dd 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 39212b7e0..e7fe14800 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 5a1dbce41..f84a73238 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 5f3ac7202..82f5a75ce 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);


More information about the Libreoffice-commits mailing list