Skip to content

Commit

Permalink
Merge pull request ClickHouse#60768 from Algunenano/2024a
Browse files Browse the repository at this point in the history
Update tzdata to 2024a
  • Loading branch information
alexey-milovidov authored and Enmk committed May 6, 2024
1 parent 70872e9 commit 3cceaf6
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion contrib/cctz
Submodule cctz updated 77 files
+16 −4 BUILD
+3 −1 CMakeLists.txt
+2 −2 include/cctz/civil_time_detail.h
+1 −0 include/cctz/time_zone.h
+1 −112 src/cctz_benchmark.cc
+1 −1 src/time_zone_fixed.cc
+4 −4 src/time_zone_format.cc
+199 −187 src/time_zone_format_test.cc
+10 −6 src/time_zone_if.cc
+6 −3 src/time_zone_if.h
+4 −2 src/time_zone_impl.cc
+4 −0 src/time_zone_impl.h
+358 −331 src/time_zone_info.cc
+8 −17 src/time_zone_info.h
+51 −33 src/time_zone_libc.cc
+7 −2 src/time_zone_libc.h
+121 −24 src/time_zone_lookup.cc
+47 −135 src/time_zone_lookup_test.cc
+1 −1 src/time_zone_posix.h
+3 −11 src/tzfile.h
+1 −1 testdata/README.zoneinfo
+1 −1 testdata/version
+ testdata/zoneinfo/America/Ensenada
+ testdata/zoneinfo/America/Godthab
+ testdata/zoneinfo/America/Goose_Bay
+ testdata/zoneinfo/America/Indiana/Winamac
+ testdata/zoneinfo/America/Matamoros
+ testdata/zoneinfo/America/Metlakatla
+ testdata/zoneinfo/America/Miquelon
+ testdata/zoneinfo/America/Moncton
+ testdata/zoneinfo/America/Montreal
+ testdata/zoneinfo/America/Nipigon
+ testdata/zoneinfo/America/Nuuk
+ testdata/zoneinfo/America/Ojinaga
+ testdata/zoneinfo/America/Santa_Isabel
+ testdata/zoneinfo/America/Scoresbysund
+ testdata/zoneinfo/America/St_Johns
+ testdata/zoneinfo/America/Thunder_Bay
+ testdata/zoneinfo/America/Tijuana
+ testdata/zoneinfo/America/Toronto
+ testdata/zoneinfo/Antarctica/Casey
+ testdata/zoneinfo/Antarctica/Macquarie
+ testdata/zoneinfo/Antarctica/Troll
+ testdata/zoneinfo/Antarctica/Vostok
+ testdata/zoneinfo/Asia/Almaty
+ testdata/zoneinfo/Asia/Gaza
+ testdata/zoneinfo/Asia/Hebron
+ testdata/zoneinfo/Asia/Ho_Chi_Minh
+ testdata/zoneinfo/Asia/Nicosia
+ testdata/zoneinfo/Asia/Qostanay
+ testdata/zoneinfo/Asia/Saigon
+ testdata/zoneinfo/Canada/Eastern
+ testdata/zoneinfo/Canada/Newfoundland
+ testdata/zoneinfo/Europe/Belfast
+ testdata/zoneinfo/Europe/Bucharest
+ testdata/zoneinfo/Europe/Chisinau
+ testdata/zoneinfo/Europe/Guernsey
+ testdata/zoneinfo/Europe/Isle_of_Man
+ testdata/zoneinfo/Europe/Jersey
+ testdata/zoneinfo/Europe/Kiev
+ testdata/zoneinfo/Europe/Kyiv
+ testdata/zoneinfo/Europe/London
+ testdata/zoneinfo/Europe/Nicosia
+ testdata/zoneinfo/Europe/Riga
+ testdata/zoneinfo/Europe/Sofia
+ testdata/zoneinfo/Europe/Tallinn
+ testdata/zoneinfo/Europe/Tiraspol
+ testdata/zoneinfo/Europe/Uzhgorod
+ testdata/zoneinfo/Europe/Vilnius
+ testdata/zoneinfo/Europe/Zaporozhye
+ testdata/zoneinfo/GB
+ testdata/zoneinfo/GB-Eire
+ testdata/zoneinfo/Mexico/BajaNorte
+ testdata/zoneinfo/Pacific/Norfolk
+11 −6 testdata/zoneinfo/iso3166.tab
+15 −14 testdata/zoneinfo/zone1970.tab
+303 −0 testdata/zoneinfo/zonenow.tab
9 changes: 9 additions & 0 deletions src/Core/SettingsFields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#include <IO/ReadHelpers.h>
#include <IO/ReadBufferFromString.h>
#include <IO/WriteHelpers.h>

#include <boost/algorithm/string/predicate.hpp>
#include <cctz/time_zone.h>

#include <cmath>

Expand Down Expand Up @@ -441,6 +443,13 @@ String SettingFieldEnumHelpers::readBinary(ReadBuffer & in)
}


void SettingFieldTimezone::validateTimezone(const std::string & tz_str)
{
cctz::time_zone validated_tz;
if (!tz_str.empty() && !cctz::load_time_zone(tz_str, &validated_tz))
throw DB::Exception(DB::ErrorCodes::BAD_ARGUMENTS, "Invalid time zone: {}", tz_str);
}

String SettingFieldCustom::toString() const
{
return value.dump();
Expand Down
31 changes: 31 additions & 0 deletions src/Core/SettingsFields.h
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,37 @@ void SettingFieldMultiEnum<EnumT, Traits>::readBinary(ReadBuffer & in)
return std::initializer_list<std::pair<const char*, NEW_NAME>> __VA_ARGS__ .size();\
}

/// Setting field for specifying user-defined timezone. It is basically a string, but it needs validation.
struct SettingFieldTimezone
{
String value;
bool changed = false;

explicit SettingFieldTimezone(std::string_view str = {}) { validateTimezone(std::string(str)); value = str; }
explicit SettingFieldTimezone(const String & str) { validateTimezone(str); value = str; }
explicit SettingFieldTimezone(String && str) { validateTimezone(str); value = std::move(str); }
explicit SettingFieldTimezone(const char * str) { validateTimezone(str); value = str; }
explicit SettingFieldTimezone(const Field & f) { const String & str = f.safeGet<const String &>(); validateTimezone(str); value = str; }

SettingFieldTimezone & operator =(std::string_view str) { validateTimezone(std::string(str)); value = str; changed = true; return *this; }
SettingFieldTimezone & operator =(const String & str) { *this = std::string_view{str}; return *this; }
SettingFieldTimezone & operator =(String && str) { validateTimezone(str); value = std::move(str); changed = true; return *this; }
SettingFieldTimezone & operator =(const char * str) { *this = std::string_view{str}; return *this; }
SettingFieldTimezone & operator =(const Field & f) { *this = f.safeGet<const String &>(); return *this; }

operator const String &() const { return value; } /// NOLINT
explicit operator Field() const { return value; }

const String & toString() const { return value; }
void parseFromString(const String & str) { *this = str; }

void writeBinary(WriteBuffer & out) const;
void readBinary(ReadBuffer & in);

private:
void validateTimezone(const std::string & tz_str);
};

/// Can keep a value of any type. Used for user-defined settings.
struct SettingFieldCustom
{
Expand Down

0 comments on commit 3cceaf6

Please sign in to comment.