MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / Time

Method Time

pkg/filament/cpython/object.go:328–337  ·  view source on GitHub ↗

Time returns the time from the raw Python object.

()

Source from the content-addressed store, hash-verified

326
327// Time returns the time from the raw Python object.
328func (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.
340func (ob *PyObject) Type() string {

Callers 1

GetSliceMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected