Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 58865200CD9 for ; Thu, 3 Aug 2017 18:30:52 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5152616BF4D; Thu, 3 Aug 2017 16:30:52 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BA29516BF49 for ; Thu, 3 Aug 2017 18:30:51 +0200 (CEST) Received: (qmail 1942 invoked by uid 500); 3 Aug 2017 16:30:50 -0000 Mailing-List: contact dev-help@orc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@orc.apache.org Delivered-To: mailing list dev@orc.apache.org Received: (qmail 1931 invoked by uid 99); 3 Aug 2017 16:30:50 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Aug 2017 16:30:50 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6DD87DFF36; Thu, 3 Aug 2017 16:30:50 +0000 (UTC) From: grundprinzip To: dev@orc.apache.org Reply-To: dev@orc.apache.org References: In-Reply-To: Subject: [GitHub] orc pull request #142: [ORC-218] Cache timezone information in the library. Content-Type: text/plain Message-Id: <20170803163050.6DD87DFF36@git1-us-west.apache.org> Date: Thu, 3 Aug 2017 16:30:50 +0000 (UTC) archived-at: Thu, 03 Aug 2017 16:30:52 -0000 Github user grundprinzip commented on a diff in the pull request: https://github.com/apache/orc/pull/142#discussion_r131192257 --- Diff: c++/src/Timezone.cc --- @@ -735,18 +739,36 @@ namespace orc { * Get the local timezone. */ const Timezone& getLocalTimezone() { +#ifdef TZ_DB_STATIC_TZ +#define TZ_STR(x) #x + return getTimezoneByName(TZ_STR(TZ_DB_STATIC_TZ)); +#else return getTimezoneByFilename(LOCAL_TIMEZONE); +#endif } /** * Get a timezone by name (eg. America/Los_Angeles). * Results are cached. */ const Timezone& getTimezoneByName(const std::string& zone) { +#ifdef USE_TZ_DB + { + std::lock_guard timezone_lock(timezone_mutex); + std::map >::iterator itr = + timezoneCache.find(zone); + if (itr != timezoneCache.end()) { + return *(itr->second).get(); + } + timezoneCache[zone] = std::shared_ptr(new TimezoneImpl(zone, TZ_DATABASE[zone])); --- End diff -- Done --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---