zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #14010
[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/123494
--
https://code.launchpad.net/~davidagraf/zorba/lastmodifiedfix/+merge/123494
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog 2012-09-09 07:46:57 +0000
+++ ChangeLog 2012-09-10 07:14:24 +0000
@@ -26,6 +26,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-10 07:14:24 +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