Github user maver1ck commented on a diff in the pull request:
https://github.com/apache/spark/pull/19234#discussion_r139290042
--- Diff: python/pyspark/sql/types.py ---
@@ -196,7 +199,9 @@ def toInternal(self, dt):
def fromInternal(self, ts):
if ts is not None:
# using int to avoid precision loss in float
- return datetime.datetime.fromtimestamp(ts //
1000000).replace(microsecond=ts % 1000000)
+ y, m, d, hh, mm, ss, _, _, _ = (time.gmtime(ts // 1000000) if
_is_utc
+ else time.localtime(ts //
1000000))
+ return datetime.datetime(y, m, d, hh, mm, ss, ts % 1000000)
--- End diff --
I added some description and support for leap seconds
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]