From: Dana Merrick Date: 2008-08-26T06:51:18+09:00 Subject: Re: Uptime Since... (#174) --------------enig2DD3D3264CDE36AB64DCFAA3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Nathan Powell wrote: > Mine (Only tested on a couple of Linux boxes): >=20 >=20 > if `uptime`.include? "day" > puts(Time.now - ((`uptime`.split[2].to_i * 1440) + (`uptime`.split[4]= =2Esplit(":")[0].to_i * 60) + (`uptime`.split[4].split(":")[1].to_i)) * 6= 0) > elsif `uptime`.include? "min" > puts(Time.now - `uptime`.split[2].split(":")[0].to_i * 60) > else > puts(Time.now - (`uptime`.split[2].split(":")[0].to_i * 60) + (`uptim= e`.split[2].split(":")[1].to_i)) > end I may be wrong, but won't the results from this be skewed because you are= running uptime several times (and presumably the resulting data will be different each time you run it)? It's not like that couldn't be fixed very easily by just assigning a vari= able. Nice solution, though! -Dana --=20 Dana Merrick - System Administrator Integrated Computer Solutions, Inc. 54B Middlesex Tpke, Bedford, MA 01730 617.621.0060 x112 - http://www.ics.com --------------enig2DD3D3264CDE36AB64DCFAA3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (Darwin) iD8DBQFIsypZ7b+8UB5G/wMRAu1zAKCGyXeNYpbFH6LtYM4386r0UslIQQCfXKDX BJY+tr+XkEg2++YtDR0qQEA= =jAqp -----END PGP SIGNATURE----- --------------enig2DD3D3264CDE36AB64DCFAA3--