OpenOffice Calc time conversion
I was profiling some programs using the "time" command on linux. This outputted its results in a format like this: 1m48.952s
Now I would like to tabulate and graph all my collected data but it's not easy when it's in this format.
I have two questions: 1. Is there a way to easily convert this format into solely pure seconds. Perhaps an OpenOffice Calc function? 2. Is there a way to call my "开发者_运维百科time" command so that it will output in seconds and not minutes-seconds.
Thank you so much
Well you tagged this with excel, so here's the excel solution:
=IF(ISERROR(FIND("m",A1)),VALUE(LEFT(A1,FIND("s",A1)-1)), LEFT(A1,FIND("m",A1)-1)*60+MID(A1,FIND("m",A1)+1,FIND("s",A1)-FIND("m",A1)-1))
It's a simple formula so it will probably translate directly for open office. Here's some sample results:
As for your second question, man time explains that you can -f FORMAT
your output. Description of how you set the format string is in the link. I believe you want -f %e
Elapsed real time (in seconds). The default appears to be %E
Elapsed real time (in [hours:]minutes:seconds).
精彩评论