詹金斯休息以人类格式获得持续时间 [英] jenkins rest get duration in human format

查看:59
本文介绍了詹金斯休息以人类格式获得持续时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过curl命令获取工作时间.

I need to get job duration via curl command.

我可以访问它

curl -s $ JENKINS_JOB_URL/146/api/json?tree = duration

curl -s $JENKINS_JOB_URL/146/api/json?tree=duration

{持续时间":14182142}

{"duration":14182142}

如何将14182142转换为"3 hr 56 min"? (通过ksh或curl命令中)

How convert the 14182142 to "3 hr 56 min" ? ( via ksh, or in the curl command )

谢谢

推荐答案

您总是可以使用一些python:

You could always use some python:

python -c"import datetime;print datetime.timedelta(milliseconds=14182142);"

3:56:22.142000

3:56:22.142000

这篇关于詹金斯休息以人类格式获得持续时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆