- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试测量引导加载程序时序,其中我需要测量 SPL、U-Boot 和总时间(SPL + U-Boot)。我的 minicom 控制台日志条目如下所示
$ cat u-boot-2017-01 | grep -e 'U-Boot SPL 2017' -e 'U-Boot 2017.01' -e 'Starting kernel ...'
[2018-10-11 15:05:11.021] U-Boot SPL 2017.01-05786-ge0aa2fcb13 (Oct 10 2018 - 13:53:01)
[2018-10-11 15:05:11.294] U-Boot 2017.01-05786-ge0aa2fcb13 (Oct 10 2018 - 13:53:01 -0400)
[2018-10-11 15:05:12.706] Starting kernel ...
现在
SPL boot time is : timestamp diff of line 1 and line 2 ( SPL start and U-Boot start)
U-Boot boot time is : timestamp diff of line 2 and line 3 ( U-Boot start and starting kernel)
Total time is : timestamp diff of line 1 and line 3.
我看到 python timedelta支持年、月、日、时、分、秒、微秒、毫秒,但不确定如何将此时间戳转换为 timedelta。我正在学习 python,所以想在那里尝试一下。有人可以建议应该怎么做。我必须对多个产品和多个版本的引导加载程序进行这些测量,因此编写脚本会很好。
最佳答案
使用 datetime.strptime
非常简单, 只需要确保使用正确的格式即可。
查看可用指令 here .
from datetime import datetime
start_time = '2018-10-11 15:05:11.021'
end_time = '2018-10-11 15:05:11.294'
FORMAT = '%Y-%m-%d %H:%M:%S.%f'
print(datetime.strptime(end_time, FORMAT) - datetime.strptime(start_time, FORMAT))
# 0:00:00.273000
关于python - 在python中获取时间戳差异的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52767775/
给定一个带有多个 date_time 戳的字符串,我想 提取第一个戳及其前面的文本 候选字符串可以有一个或多个时间戳 后续的 date_time 戳记将被 sep="-" 隔开 后续date_time
是否可以合并从相机拍摄的文本和照片?我想在照片上标记日期和时间,但我在 Google 上找不到任何内容。 最佳答案 使用下面的代码来实现你所需要的。 Bitmap src = Bitm
有没有办法通过 Graph API 戳另一个用户?基于this post ,并使用 Graph Explorer ,我发布到“/USERID/pokes”,我已经授予它(Graph API 应用程序和
我有两个向左浮动的元素。一个是 body 的第一个 child ,另一个是容器的第一个 child ,容器是 body 的第二个 child 。 ...
我是一名优秀的程序员,十分优秀!