Get POSIX/Unix time in seconds and nanoseconds in Python?

后端 未结 6 1357
春和景丽
春和景丽 2020-12-01 10:33

I\'ve been trying to find a way to get the time since 1970-01-01 00:00:00 UTC in seconds and nanoseconds in python and I cannot find anything that will give me the proper pr

6条回答
  •  情话喂你
    2020-12-01 10:49

    I don't think there's a platform-independent way (maybe some third party has coded one, but I can't find it) to get time in nanoseconds; you need to do it in a platform-specific way. For example, this SO question's answer shows how to do it on platform that supply a librt.so system library for "realtime" operations.

提交回复
热议问题