[Libreoffice-commits] online.git: common/Util.cpp wsd/Storage.cpp

Tor Lillqvist (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 3 11:50:45 UTC 2019


 common/Util.cpp |    2 +-
 wsd/Storage.cpp |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 80ddb46392d5478e5044445eb90f51a571331023
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Tue Sep 3 13:23:32 2019 +0300
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Tue Sep 3 13:50:27 2019 +0200

    Fix portability problems after 22f1656e08d1cc873a523bf1f869bdd75066dd2a
    
    It is std::chrono::system_clock that has to_time_t.
    std::chrono::steady_clock does not have to_time_t.
    
    std::chrono::high_resolution_clock is either the same as system_clock
    (in libstdc++, on Linux) or steady_clock (libc++, on iOS).
    
    (This change does not fix the actual bugs in the code, just makes it
    compile for iOS. The new ISO8601 fractional time code is not unit
    tested at the moment. The testTime() function is not part of the test
    suite in WhiteBoxTests.cpp. If it is made part of it, it reveals
    problems in the code (and/or in the unit test code).)
    
    Change-Id: Id33342bc8b26465632f3d21d6ec2f3c975ae3681
    Reviewed-on: https://gerrit.libreoffice.org/78550
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/common/Util.cpp b/common/Util.cpp
index 00454f0f8..80efed440 100644
--- a/common/Util.cpp
+++ b/common/Util.cpp
@@ -797,7 +797,7 @@ namespace Util
 
     std::string getIso8601FracformatTime(std::chrono::system_clock::time_point time){
         char time_modified[64];
-        std::time_t lastModified_us_t = std::chrono::high_resolution_clock::to_time_t(time);
+        std::time_t lastModified_us_t = std::chrono::system_clock::to_time_t(time);
         std::tm lastModified_tm = *std::gmtime(&lastModified_us_t);
         strftime(time_modified, sizeof(time_modified), "%FT%T.", &lastModified_tm);
 
diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp
index db82d913a..992f4a0d3 100644
--- a/wsd/Storage.cpp
+++ b/wsd/Storage.cpp
@@ -261,7 +261,7 @@ std::unique_ptr<LocalStorage::LocalFileInfo> LocalStorage::getLocalFileInfo()
     std::string str_path = path.toString();
     const auto& filename = path.getFileName();
     const Poco::File file = Poco::File(path);
-    std::chrono::high_resolution_clock::time_point lastModified = Util::getFileTimestamp(str_path);
+    std::chrono::system_clock::time_point lastModified = Util::getFileTimestamp(str_path);
     const size_t size = file.getSize();
 
     setFileInfo(FileInfo({filename, "localhost", lastModified, size}));


More information about the Libreoffice-commits mailing list