Compare normalized nanosec timestamps in TemplateFolderCacheImpl::equalStates

After 9830fd36db "date/time IDL datatypes
incompatible change", 4fa553e407 "fdo#62088: Fix
regression introduced by the DateTime incompatible change." had fixed
writing/reading timestamps to/from the .templdir.cache file, by cutting from
nanosecond precision back to 1/100th-second precision.  But in the call to
TemplateFolderCacheImpl::equalState, the (cut-down) timestamps read from the
.templdir.cache file were then compared against (not--cut-down) timestamps
reported by the filesystem, potentially causing equalState to erroneously return
false.  (This is only relevant on Windows, as the non-Windows implementation in
sal/osl/unx/file_stat.cxx always sets Nanonsec = 0 for all the timestamps it
reports.)

Change-Id: I34b99024531d4d2e49bb53450e8f6fd13397f237
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184505
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
This commit is contained in:
Stephan Bergmann
2025-04-23 16:42:34 +02:00
parent 01d94f0734
commit f5cca58c2e
+9 -2
View File
@@ -134,6 +134,12 @@ namespace svt
// attribute access
OUString getURL( ) const { return m_aURL.GetMainURL( INetURLObject::DecodeMechanism::ToIUri ); }
void setModDate( const util::DateTime& _rDate ) { m_aLastModified = _rDate; }
void setModDateNormalized( const util::DateTime& _rDate ) {
auto norm = _rDate;
norm.NanoSeconds
= (norm.NanoSeconds / tools::Time::nanoPerCenti) * tools::Time::nanoPerCenti;
setModDate(norm);
}
const util::DateTime& getModDate( ) const { return m_aLastModified; }
TemplateFolderContent& getSubContents() { return m_aSubContents; }
@@ -568,9 +574,10 @@ namespace svt
::rtl::Reference< TemplateContent > xChild = new TemplateContent( std::move(aSubContentURL) );
// the modified date
xChild->setModDate( xRow->getTimestamp( 2 ) ); // date modified
xChild->setModDateNormalized( xRow->getTimestamp( 2 ) ); // date modified
if ( xRow->wasNull() )
xChild->setModDate( xRow->getTimestamp( 3 ) ); // fallback: date created
xChild->setModDateNormalized( xRow->getTimestamp( 3 ) );
// fallback: date created
// push back this content
_rxRoot->push_back( xChild );