Date: Thu, 14 Aug 2003 12:23:34 -0500 From: Stephen Hilton <nospam@hiltonbsd.com> To: "Charles Howse" <chowse@charter.net> Cc: freebsd-questions@freebsd.org Subject: Re: Using bc in bash script Message-ID: <20030814122334.0a05ab4b.nospam@hiltonbsd.com> In-Reply-To: <003001c36287$2a2a7b40$04fea8c0@moe> References: <20030814115313.2707cb21.nospam@hiltonbsd.com> <003001c36287$2a2a7b40$04fea8c0@moe>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 14 Aug 2003 12:11:55 -0500
"Charles Howse" <chowse@charter.net> wrote:
> > Charles,
> >
> > This will set bc precision to 5 decimal places:
> >
> > et=`echo "scale=5 ; $end_time - $start_time" | bc`
>
> Ohhh, I was really hoping on that one...but no, it still reports 0
> seconds.
Sorry I jumped the gun there, the scale is needed for this to work
but the "date +%s" willonly resolve into whole seconds after reading
the date man page.
I sure am curious as to how to solve this also, the /usr/bin/time
command man page says this:
-----------------snip------------------
DESCRIPTION
The time utility executes and times the specified utility. After the
utility finishes, time writes to the standard error stream, (in seconds):
the total time elapsed, the time used to execute the utility process and
the time consumed by system overhead.
-----------------snip------------------
So that looks like seconds only also.
A quick browse through "man sh" and "man bash" look like their
builtin time commands also resolve to seconds.
Curiousy,
Stephen Hilton
nospam@hiltonbsd.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030814122334.0a05ab4b.nospam>
