MCPcopy Index your code
hub / github.com/python/cpython / convert_timestamp

Function convert_timestamp

Lib/sqlite3/dbapi2.py:72–84  ·  view source on GitHub ↗
(val)

Source from the content-addressed store, hash-verified

70 return datetime.date(*map(int, val.split(b"-")))
71
72 def convert_timestamp(val):
73 warn(msg.format(what="timestamp converter"), DeprecationWarning, stacklevel=2)
74 datepart, timepart = val.split(b" ")
75 year, month, day = map(int, datepart.split(b"-"))
76 timepart_full = timepart.split(b".")
77 hours, minutes, seconds = map(int, timepart_full[0].split(b":"))
78 if len(timepart_full) == 2:
79 microseconds = int('{:0<6.6}'.format(timepart_full[1].decode()))
80 else:
81 microseconds = 0
82
83 val = datetime.datetime(year, month, day, hours, minutes, seconds, microseconds)
84 return val
85
86
87 register_adapter(datetime.date, adapt_date)

Callers

nothing calls this directly

Calls 5

warnFunction · 0.90
datetimeMethod · 0.80
formatMethod · 0.45
splitMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…