summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-02-23 10:31:21 +0100
committerAndras Timar <andras.timar@collabora.com>2015-03-04 03:12:17 -0800
commit9d5591ccd3b1812914d9dd52e872e5efd3a0dc5f (patch)
treeaaea6e7772ef4ae880d148a72ca0b91cb84ec311
parent093eae4fef6def6ea1569115dab9d41a8ba9e163 (diff)
file UCP: Ensure myLocalTime is initialized
When a file's time is epoch (1970-01-01 00:00:00, i.e., TimeValue temp is all zero) and the TZ is UTC or westward, osl_getLocalTimeFromSystemTime returns false and leaves myLocalTime uninitialized. That e.g. confuses getModuleByUrl (scripting/source/pyprov/pythonscript.py), potentially re-loading a Python script with epoch time (as happens e.g. for the share/Scripts/python/ files in an xdg-app installation of LO) every time it is accessed, falsely assuming it has changed on disk since last load. Change-Id: I8d4228feb28e2697a7021e3488ae2c09e8439ed8 (cherry picked from commit 94c9206399954d018aae8a1bd4e4b33354b9cdaf) Reviewed-on: https://gerrit.libreoffice.org/14588 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit 8aeef8bcff2ed7ab873aa572728d266206dbcca5)
-rw-r--r--include/sal/log-areas.dox1
-rw-r--r--ucb/source/ucp/file/shell.cxx9
2 files changed, 9 insertions, 1 deletions
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index d42c8c202908..c12740c8e08a 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -334,6 +334,7 @@ certain functionality.
@li @c ucb.ucp
@li @c ucb.ucp.cmis
@li @c ucb.ucp.ext
+@li @c ucb.ucp.file
@li @c ucb.ucp.ftp
@li @c ucb.ucp.gio
@li @c ucb.ucp.gvfs
diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx
index 6fc7814c4ba2..d3b6a80db0f5 100644
--- a/ucb/source/ucp/file/shell.cxx
+++ b/ucb/source/ucp/file/shell.cxx
@@ -2440,7 +2440,14 @@ shell::commit( const shell::ContentMap::iterator& it,
// Convert system time to local time (for EA)
TimeValue myLocalTime;
- osl_getLocalTimeFromSystemTime( &temp, &myLocalTime );
+ if (!osl_getLocalTimeFromSystemTime( &temp, &myLocalTime ))
+ {
+ SAL_WARN(
+ "ucb.ucp.file",
+ "cannot convert (" << temp.Seconds << ", " << temp.Nanosec
+ << ") to local time");
+ myLocalTime = temp;
+ }
oslDateTime myDateTime;
osl_getDateTimeFromTimeValue( &myLocalTime, &myDateTime );