Time returns the time from the raw Python object.
()
| 326 | |
| 327 | // Time returns the time from the raw Python object. |
| 328 | func (ob *PyObject) Time() time.Time { |
| 329 | year := int(C.PyDate_GetYear((*C.PyObject)(unsafe.Pointer(ob)))) |
| 330 | month := int(C.PyDate_GetMonth((*C.PyObject)(unsafe.Pointer(ob)))) |
| 331 | day := int(C.PyDate_GetDay((*C.PyObject)(unsafe.Pointer(ob)))) |
| 332 | hour := int(C.PyDate_GetHour((*C.PyObject)(unsafe.Pointer(ob)))) |
| 333 | minute := int(C.PyDate_GetMinute((*C.PyObject)(unsafe.Pointer(ob)))) |
| 334 | second := int(C.PyDate_GetSecond((*C.PyObject)(unsafe.Pointer(ob)))) |
| 335 | microsecond := int(C.PyDate_GetMicroSecond((*C.PyObject)(unsafe.Pointer(ob)))) |
| 336 | return time.Date(year, time.Month(month), day, hour, minute, second, microsecond*1000, time.Local) |
| 337 | } |
| 338 | |
| 339 | // Type returns the Python type representation. |
| 340 | func (ob *PyObject) Type() string { |