summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2019-03-28 14:57:50 +0100
committerPeter Varga <pvarga@inf.u-szeged.hu>2019-03-28 14:10:42 +0000
commit1110b9b50e61bf2663e2037ce9e28e74a8943919 (patch)
treef3b254b369f8e1fe44e35b0095726e4bd6e2afe8
parentdad0cfa3eba01b0dff698f457242f80f6eae4698 (diff)
Fix timestamp deduplication for Windows
Based on https://chromium-review.googlesource.com/c/chromium/src/+/1432882 Task-number: QTBUG-74764 Change-Id: I74b4711f5146d2d2261487f13ccac702b9aa969e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--src/core/download_manager_delegate_qt.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp
index f0f0c93b9..76b0bea74 100644
--- a/src/core/download_manager_delegate_qt.cpp
+++ b/src/core/download_manager_delegate_qt.cpp
@@ -175,8 +175,15 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem*
int uniquifier = base::GetUniquePathNumber(tmpFilePath, base::FilePath::StringType());
if (uniquifier > 0)
suggestedFilePath = toQt(tmpFilePath.InsertBeforeExtensionASCII(base::StringPrintf(" (%d)", uniquifier)).AsUTF8Unsafe());
- else if (uniquifier == -1)
- suggestedFilePath = toQt(tmpFilePath.InsertBeforeExtensionASCII(base::StringPrintf(" - %s", base::TimeToISO8601(item->GetStartTime()).c_str())).AsUTF8Unsafe());
+ else if (uniquifier == -1) {
+ base::Time::Exploded exploded;
+ item->GetStartTime().LocalExplode(&exploded);
+ std::string suffix = base::StringPrintf(
+ " - %04d-%02d-%02dT%02d%02d%02d.%03d", exploded.year, exploded.month,
+ exploded.day_of_month, exploded.hour, exploded.minute,
+ exploded.second, exploded.millisecond);
+ suggestedFilePath = toQt(tmpFilePath.InsertBeforeExtensionASCII(suffix).AsUTF8Unsafe());
+ }
item->AddObserver(this);
QList<ProfileAdapterClient*> clients = m_profileAdapter->clients();