diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-11-26 14:49:39 +0300 |
---|---|---|
committer | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-11-26 14:49:39 +0300 |
commit | 136e0d684355cf24c27ea98473830756a8f19ba0 (patch) | |
tree | d587e68bf4a1de4cb187ed01fe268accabce71fa /src/common | |
parent | 2cd1d8f387bea90075c52936c3d4ab0ceeeebe0d (diff) | |
parent | 675bba78d054ed04a9ee19c4b103f9eb4734e13c (diff) |
Merge remote-tracking branch 'origin/2.10'
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/utility.cpp | 17 | ||||
-rw-r--r-- | src/common/utility.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/common/utility.cpp b/src/common/utility.cpp index 861424ac3..c2c1467c4 100644 --- a/src/common/utility.cpp +++ b/src/common/utility.cpp @@ -48,6 +48,8 @@ #include <math.h> #include <stdarg.h> +using namespace std::chrono; + namespace OCC { Q_LOGGING_CATEGORY(lcUtility, "sync.utility") @@ -573,4 +575,19 @@ QString Utility::sanitizeForFileName(const QString &name) return result; } +QDebug &operator<<(QDebug &debug, nanoseconds in) +{ + QDebugStateSaver save(debug); + debug.nospace(); + const auto h = duration_cast<hours>(in); + const auto min = duration_cast<minutes>(in -= h); + const auto s = duration_cast<seconds>(in -= min); + const auto ms = duration_cast<milliseconds>(in -= s); + return debug << "std::chrono::duration(" + << h.count() << "h, " + << min.count() << "min, " + << s.count() << "s, " + << ms.count() << "ms)"; +} + } // namespace OCC diff --git a/src/common/utility.h b/src/common/utility.h index 078fe4b8e..753d42791 100644 --- a/src/common/utility.h +++ b/src/common/utility.h @@ -346,5 +346,6 @@ inline bool Utility::isBSD() #endif } +OCSYNC_EXPORT QDebug &operator<<(QDebug &debug, std::chrono::nanoseconds in); } #endif // UTILITY_H |