Project

General

Profile

Bug #7275

WDateTime + Dbo bug

Added by Emeric Poupon about 3 years ago. Updated about 3 years ago.

Status:
Feedback
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
10/09/2019
Due date:
% Done:

0%

Estimated time:

Description

Hello,

I cache a last write date time in a dbo object (using Wt::WDateTime) to skip it if it has not changed.

But I noticed a regression since I switched from boost::filesystem to std::filesystem.

Here is the scenario:

Wt::WDateTime lastWrite {std::filesystem::last_write_time(myFilePath)};

MyDboObject obj {...};
obj.modify()->setLastWrite(lastWrite);

Later:

Wt::WDateTime lastWrite {std::filesystem::last_write_time(myFilePath)};

MyDboObject obj {...};
if (obj->getLastWrite() == lastWrite)  // does not work even if they are the same!
   // Skip

MyDboObject obj {...};
if (obj->getLastWrite().toTime_t() == lastWrite.toTime_t())  // works!
   // Skip
#1

Updated by Roel Standaert about 3 years ago

  • Status changed from New to Feedback

Maybe this is a precision thing? It's not stored in the database with the same precision? I'm not sure if this is actually a bug in Wt.

What compiler and OS are you using here? Which implementation of std::filesystem? With GCC/@libstdc@ this doesn't actually compile because the file clock and the system clock are a different type.

Also available in: Atom PDF