diff --git a/devel/705.md b/devel/705.md new file mode 100644 index 0000000000..0af81a75f4 --- /dev/null +++ b/devel/705.md @@ -0,0 +1,6 @@ +[705] 解决 WASM 环境下`QDateTime` UTC 处理问题 +# What +在 Qt WASM 环境中,`QTimeZone` API 存在差异,原实现所用的 `QTimeZone::utc()` 的无法使用 + +# How +在 WASM 平台使用 `toUTC()` diff --git a/src/Mogan/Cache/thumbnail_loader.cpp b/src/Mogan/Cache/thumbnail_loader.cpp index 49f6d89d73..51215e24c3 100644 --- a/src/Mogan/Cache/thumbnail_loader.cpp +++ b/src/Mogan/Cache/thumbnail_loader.cpp @@ -133,7 +133,12 @@ ThumbnailLoader::processQueue () { lmStr, "ddd, dd MMM yyyy hh:mm:ss 'GMT'"); } if (lastModified.isValid ()) { +#ifdef OS_WASM + // WASM version of Qt seems to have difference API on this + lastModified= lastModified.toUTC (); +#else lastModified.setTimeZone (QTimeZone::utc ()); +#endif } } diff --git a/src/Plugins/Qt/qt_pdf_preview_widget.cpp b/src/Plugins/Qt/qt_pdf_preview_widget.cpp index 6faab28470..d477673c78 100644 --- a/src/Plugins/Qt/qt_pdf_preview_widget.cpp +++ b/src/Plugins/Qt/qt_pdf_preview_widget.cpp @@ -429,7 +429,12 @@ QTPdfPreviewWidget::processNetworkReply (QPointer reply) { lastModified= QDateTime::fromString (lastModStr, Qt::RFC2822Date); } if (lastModified.isValid ()) { +#ifdef OS_WASM + // WASM version of Qt seems to have difference API on this + lastModified= lastModified.toUTC (); +#else lastModified.setTimeZone (QTimeZone::utc ()); +#endif } }