MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / timeTzToTimeStampTz

Method timeTzToTimeStampTz

src/common/TimeZoneUtil.cpp:952–976  ·  view source on GitHub ↗

Converts a time-tz to timestamp-tz.

Source from the content-addressed store, hash-verified

950
951// Converts a time-tz to timestamp-tz.
952ISC_TIMESTAMP_TZ TimeZoneUtil::timeTzToTimeStampTz(const ISC_TIME_TZ& timeTz, Callbacks* cb)
953{
954 // SQL: Copy date fields from CURRENT_DATE and time and time zone fields from the source.
955
956 struct tm localTimes;
957 TimeStamp::decode_date(cb->getLocalDate(), &localTimes);
958
959 ISC_TIMESTAMP_TZ tsTz;
960 tsTz.time_zone = timeTz.time_zone;
961 tsTz.utc_timestamp.timestamp_date = TIME_TZ_BASE_DATE;
962 tsTz.utc_timestamp.timestamp_time = timeTz.utc_time;
963
964 struct tm times;
965 int fractions;
966 decodeTimeStamp(tsTz, false, NO_OFFSET, &times, &fractions);
967
968 times.tm_mday = localTimes.tm_mday;
969 times.tm_mon = localTimes.tm_mon;
970 times.tm_year = localTimes.tm_year;
971
972 tsTz.utc_timestamp = TimeStamp::encode_timestamp(&times, fractions);
973 localTimeStampToUtc(tsTz);
974
975 return tsTz;
976}
977
978// Converts a time-tz to timestamp.
979ISC_TIMESTAMP TimeZoneUtil::timeTzToTimeStamp(const ISC_TIME_TZ& timeTz, Callbacks* cb)

Callers

nothing calls this directly

Calls 2

encode_timestampFunction · 0.85
getLocalDateMethod · 0.45

Tested by

no test coverage detected