MCPcopy Create free account
hub / github.com/apache/arrow / PyDateTime_utcoffset_s

Function PyDateTime_utcoffset_s

python/pyarrow/src/arrow/python/datetime.cc:321–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

319}
320
321Result<int64_t> PyDateTime_utcoffset_s(PyObject* obj) {
322 // calculate offset from UTC timezone in seconds
323 // supports only PyDateTime_DateTime and PyDateTime_Time objects
324 OwnedRef pyoffset(PyObject_CallMethod(obj, "utcoffset", NULL));
325 RETURN_IF_PYERROR();
326 if (pyoffset.obj() != nullptr && pyoffset.obj() != Py_None) {
327 auto delta = reinterpret_cast<PyDateTime_Delta*>(pyoffset.obj());
328 return internal::PyDelta_to_s(delta);
329 } else {
330 return 0;
331 }
332}
333
334Result<std::string> PyTZInfo_utcoffset_hhmm(PyObject* pytzinfo) {
335 // attempt to convert timezone offset objects to "+/-{hh}:{mm}" format

Callers 1

ConvertMethod · 0.85

Calls 1

PyDelta_to_sFunction · 0.85

Tested by

no test coverage detected