mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Allow to set server timezone from configuration file [#CLICKHOUSE-2765].
This commit is contained in:
parent
b1a5efffc0
commit
6ec9380510
@ -65,6 +65,17 @@
|
||||
<!-- Default database. -->
|
||||
<default_database>default</default_database>
|
||||
|
||||
<!-- Server time zone could be set here.
|
||||
|
||||
Time zone is used when converting between String and DateTime types,
|
||||
when printing DateTime in text formats and parsing DateTime from text,
|
||||
it is used in date and time related functions, if specific time zone was not passed as an argument.
|
||||
|
||||
Time zone is specified as identifier from IANA time zone database, like UTC or Africa/Abidjan.
|
||||
If not specified, system time zone at server startup is used.
|
||||
-->
|
||||
<!-- <timezone>Europe/Moscow</timezone> -->
|
||||
|
||||
<!-- Configuration of clusters that could be used in Distributed tables.
|
||||
https://clickhouse.yandex/reference_en.html#Distributed
|
||||
-->
|
||||
|
@ -745,6 +745,15 @@ void BaseDaemon::initialize(Application& self)
|
||||
}
|
||||
}
|
||||
|
||||
/// This must be done before any usage of DateLUT. In particular, before any logging.
|
||||
if (config().has("timezone"))
|
||||
{
|
||||
if (0 != setenv("TZ", config().getString("timezone").data(), 1))
|
||||
throw Poco::Exception("Cannot setenv TZ variable");
|
||||
|
||||
tzset();
|
||||
}
|
||||
|
||||
std::string log_path = config().getString("logger.log", "");
|
||||
if (!log_path.empty())
|
||||
log_path = Poco::Path(log_path).setFileName("").toString();
|
||||
|
Loading…
Reference in New Issue
Block a user