| 114 | } |
| 115 | |
| 116 | TimestampValue CivilSecondsToTimestampValue(const cctz::civil_second& cs, int64_t nanos) { |
| 117 | // boost::gregorian::date() throws boost::gregorian::bad_year if year is not in the |
| 118 | // 1400..9999 range. Need to check validity before creating the date object. |
| 119 | if (UNLIKELY(IsDateOutOfRange(cs))) { |
| 120 | return TimestampValue(); |
| 121 | } else { |
| 122 | return TimestampValue( |
| 123 | date(cs.year(), cs.month(), cs.day()), |
| 124 | time_duration(cs.hour(), cs.minute(), cs.second(), nanos)); |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | } |
| 129 |
no test coverage detected