gnucash master: Fix local timezone-dependent test.

John Ralls jralls at code.gnucash.org
Fri Jan 13 17:54:25 EST 2017


Updated	 via  https://github.com/Gnucash/gnucash/commit/67a0e46f (commit)
	from  https://github.com/Gnucash/gnucash/commit/09cbb9c1 (commit)



commit 67a0e46f18164e5689216d130f94d3d0344dc98d
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Jan 13 14:54:12 2017 -0800

    Fix local timezone-dependent test.

diff --git a/.travis.yml b/.travis.yml
index 1cdd17c..8bdfe89 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,4 +19,3 @@ install:
   - sudo apt-get --reinstall install -qq language-pack-en language-pack-fr
   - git clone https://github.com/google/googletest ~/gtest && cd ~/gtest && git checkout release-1.8.0 && cd -
 script: ./autogen.sh && ./configure GTEST_ROOT=~/gtest/googletest GMOCK_ROOT=~/gtest/googlemock && make && TZ="America/Los_Angeles" make check
-after_failure: "cat src/libqof/qof/test/test-gnc-timezone.log" 
\ No newline at end of file
diff --git a/src/libqof/qof/gnc-timezone.cpp b/src/libqof/qof/gnc-timezone.cpp
index f2e8538..3a8e14b 100644
--- a/src/libqof/qof/gnc-timezone.cpp
+++ b/src/libqof/qof/gnc-timezone.cpp
@@ -681,16 +681,24 @@ TimeZoneProvider::TimeZoneProvider(const std::string& tzname) :  zone_vector {}
         }
         catch(const std::exception& err)
         {
-            std::cerr << "Unable to use either provided tzname or TZ environment variable. Resorting to /etc/localtime.\n";
             try
             {
-                parse_file("/etc/localtime");
+                parse_file(getenv("TZ"));
             }
-            catch(const std::invalid_argument& env)
+            catch(const std::exception& err)
             {
-                std::cerr << "/etc/localtime invalid, resorting to GMT.";
-                TZ_Ptr zone(new PTZ("UTC0"));
-                zone_vector.push_back(std::make_pair(max_year, zone));
+
+                std::cerr << "Unable to use either provided tzname or TZ environment variable. Resorting to /etc/localtime.\n";
+                try
+                {
+                    parse_file("/etc/localtime");
+                }
+                catch(const std::invalid_argument& env)
+                {
+                    std::cerr << "/etc/localtime invalid, resorting to GMT.";
+                    TZ_Ptr zone(new PTZ("UTC0"));
+                    zone_vector.push_back(std::make_pair(max_year, zone));
+                }
             }
         }
     }



Summary of changes:
 .travis.yml                     |  1 -
 src/libqof/qof/gnc-timezone.cpp | 20 ++++++++++++++------
 2 files changed, 14 insertions(+), 7 deletions(-)



More information about the gnucash-changes mailing list