| 233 | } |
| 234 | |
| 235 | static inline Status PyTime_convert_int(int64_t val, const TimeUnit::type unit, |
| 236 | int64_t* hour, int64_t* minute, int64_t* second, |
| 237 | int64_t* microsecond) { |
| 238 | switch (unit) { |
| 239 | case TimeUnit::NANO: |
| 240 | if (val % 1000 != 0) { |
| 241 | return Status::Invalid("Value ", val, " has non-zero nanoseconds"); |
| 242 | } |
| 243 | val /= 1000; |
| 244 | // fall through |
| 245 | case TimeUnit::MICRO: |
| 246 | *microsecond = split_time(val, 1000000LL, &val); |
| 247 | *second = split_time(val, 60, &val); |
| 248 | *minute = split_time(val, 60, hour); |
| 249 | break; |
| 250 | case TimeUnit::MILLI: |
| 251 | *microsecond = split_time(val, 1000, &val) * 1000; |
| 252 | // fall through |
| 253 | case TimeUnit::SECOND: |
| 254 | *second = split_time(val, 60, &val); |
| 255 | *minute = split_time(val, 60, hour); |
| 256 | break; |
| 257 | default: |
| 258 | break; |
| 259 | } |
| 260 | return Status::OK(); |
| 261 | } |
| 262 | |
| 263 | static inline Status PyDate_convert_int(int64_t val, const DateUnit unit, int64_t* year, |
| 264 | int64_t* month, int64_t* day) { |
no test coverage detected