zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #13744
[Merge] lp:~davidagraf/zorba/lastmodifiedfix into lp:zorba
David Graf has proposed merging lp:~davidagraf/zorba/lastmodifiedfix into lp:zorba.
Requested reviews:
David Graf (davidagraf)
For more details, see:
https://code.launchpad.net/~davidagraf/zorba/lastmodifiedfix/+merge/122712
--
https://code.launchpad.net/~davidagraf/zorba/lastmodifiedfix/+merge/122712
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog 2012-08-31 15:21:31 +0000
+++ ChangeLog 2012-09-04 16:07:25 +0000
@@ -23,6 +23,7 @@
* Fixed bug #1042840 (qname pool free-list corruption)
* Fixed bug #866984 (better error message for an eval error)
* Fixed bug #932884 (HTML and XHTML serialization of empty elements)
+ * Fixed bug #1045902 (file:last-modified returns current date time)
version 2.6
=== modified file 'modules/org/expath/ns/file.xq.src/file.cpp'
--- modules/org/expath/ns/file.xq.src/file.cpp 2012-08-30 13:45:43 +0000
+++ modules/org/expath/ns/file.xq.src/file.cpp 2012-09-04 16:07:25 +0000
@@ -603,11 +603,19 @@
// actual last modified
try {
time_t lTime = lFile->lastModified();
- struct tm *lT = localtime(&lTime);
+ // result of localtime needs to be copied.
+ // Otherwise, nasty side effecs do happen
+ struct tm lT = *localtime(&lTime);
int gmtOffset = LastModifiedFunction::getGmtOffset();
return ItemSequence_t(new SingletonItemSequence(
- theModule->getItemFactory()->createDateTime(1900 + lT->tm_year, lT->tm_mon, lT->tm_mday, lT->tm_hour, lT->tm_min, lT->tm_sec, gmtOffset)));
+ theModule->getItemFactory()->createDateTime(1900 + lT.tm_year,
+ lT.tm_mon,
+ lT.tm_mday,
+ lT.tm_hour,
+ lT.tm_min,
+ lT.tm_sec,
+ gmtOffset)));
} catch (ZorbaException& ze) {
std::stringstream lSs;
lSs << "An unknown error occured: " << ze.what() << "Can not retrieve the last modification timestamp of";
Follow ups