Friday, February 23, 2018

Re: difference between min/max timestamps

Le vendredi 23 février 2018 14:23:19 UTC+1, Ni Va a écrit :
> Hi,
>
>
> This is a listoftimestamps=['11:02:02.602','11:00:00.402','11:05:00.402']
>
> I would like to calculate difference in second.ticks betwwen min and max?
>
>
>
> I've seen vim's time func but don't think it could help to do this work.
>
>
> Thank you

If it can help :


"time
fun! helper#timegetseconds(timestamp) "{{{
" timestart
let timestamp = split(a:timestamp,'\.')
let tick = timestamp[1]/1000.0
let [h,m,s]=split(timestamp[0],':')
return (3600*str2float(h) + 60*str2float(m) + str2float(s)) + tick
endfunction "}}}
fun! helper#timediff(timestart,timeend) "{{{
return abs(helper#timegetseconds(a:timeend)-helper#timegetseconds(a:timestart))
endfunction "}}}

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: