MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / getChineseZodiac

Function getChineseZodiac

src/Client/ClientBaseHelpers.cpp:114–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114std::string getChineseZodiac()
115{
116 time_t current_time = time(nullptr);
117 int year = DateLUT::instance().toYear(current_time);
118
119 // Traditional Chinese Zodiac
120 static constexpr const char * zodiacs[12] = {
121 "鼠", "牛", "虎", "兔", "龙", "蛇",
122 "马", "羊", "猴", "鸡", "狗", "猪"
123 };
124
125 //2020 is Rat
126 int offset = (year - 2020) % 12;
127 if (offset < 0)
128 offset += 12;
129
130 return zodiacs[offset];
131}
132
133bool isCloudEndpoint(const std::string & host)
134{

Callers 1

runInteractiveMethod · 0.85

Calls 1

toYearMethod · 0.80

Tested by

no test coverage detected