calculate time difference to the milli second

Is there a native function or otherwise to calculate the difference
between two given times to the milli second? I've searched the group
archives but the suggestions mostly come up with solutions to the
minute.

I can separate the values of hh:mm:ss.xxxx.

Thanks
dundonald [ Mi, 14 Dezember 2005 17:25 ] [ ID #1101166 ]

Re: calculate time difference to the milli second

On 14 Dec 2005 08:25:53 -0800, Dundonald
<mark.dundon [at] gmail.com> wrote:
> Is there a native function or otherwise to calculate the difference
> between two given times to the milli second? I've searched the group
> archives but the suggestions mostly come up with solutions to the
> minute.
>
> I can separate the values of hh:mm:ss.xxxx.
>
> Thanks
>
echo 01:02:03.4567 | awk -F: '{OFMT="%.3f";print $1*3600+$2*60+$3}'


--
Should I get locked in the PRINCICAL'S OFFICE today -- or have a VASECTOMY??
Bill Marcum [ Do, 15 Dezember 2005 03:32 ] [ ID #1102769 ]

Re: calculate time difference to the milli second

Dundonald <mark.dundon [at] gmail.com> wrote:
> Is there a native function or otherwise to calculate the difference
> between two given times to the milli second? I've searched the group
> archives but the suggestions mostly come up with solutions to the
> minute.
>
> I can separate the values of hh:mm:ss.xxxx.

http://home.eol.ca/~parkw/index.html#rpn

It's calculator modelled after HP-42S. So, it would go something like
rpn clearhms
rpn 0 1 2 3.456 hms++ # 0 day, 1 hour, 2 min, 3.456 sec
rpn 0 1 2 3.455 hms--
rpn = # 0 day, 0 hour, 0 min, 0.001 sec
or you can put them all in one line,
rpn clearhms 0 1 2 3.456 hms++ 0 1 2 3.455 hms-- =

--
William Park <opengeometry [at] yahoo.ca>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
http://freshmeat.net/projects/bashdiff/
William Park [ Do, 15 Dezember 2005 10:17 ] [ ID #1102775 ]
Linux » comp.unix.shell » calculate time difference to the milli second

Vorheriges Thema: ftp from excel to unix
Nächstes Thema: Bash:Substring Extraction