mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-28 20:52:57 +08:00
Resolve datetime deprecation warnings (#3433)
* Resolve datetime deprecation warnings Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com> * Resolve datetime deprecation warnings Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com> --------- Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com> Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
This commit is contained in:
@ -68,7 +68,9 @@ from opentelemetry.semconv.trace import SpanAttributes
|
|||||||
|
|
||||||
|
|
||||||
def _ns_to_time(nanoseconds):
|
def _ns_to_time(nanoseconds):
|
||||||
ts = datetime.datetime.utcfromtimestamp(nanoseconds / 1e9)
|
ts = datetime.datetime.fromtimestamp(
|
||||||
|
nanoseconds / 1e9, datetime.timezone.utc
|
||||||
|
)
|
||||||
return ts.strftime("%H:%M:%S.%f")
|
return ts.strftime("%H:%M:%S.%f")
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user