[ntp:questions] ntp version 4.2.7p257-o

Michael Tatarinov kukabu at gmail.com
Tue Feb 21 08:12:26 UTC 2012


easier :)

#!/bin/sh

eval `ntpq -c 'rv 0 ss_uptime'`

let secs=$(($ss_uptime%60))
let mins=$(($ss_uptime/60%60))
let hours=$(($ss_uptime/3600%24))
let days=$(($ss_uptime/86400))

echo "${days}d ${hours}h ${mins}m ${secs}s"


2012/2/21 Mark C. Stephens <marks at non-stop.com.au>

> [root at NTP ~]# cat ntpd-uptime
> #!/usr/local/bin/bash
>
> _time=`ntpq -c sysstats | grep  uptime | awk 'BEGIN{FS=" "}{print $2}'`
>
>
>
>   _days=`printf "scale=0;$_time / 86400\n" | bc -l`
>   _hours=`printf "scale=0;($_time / 3600) - ($_days * 24)\n"  | bc -l `
>   _minutes=`printf "scale=0;($_time / 60) - ($_days * 1440) - ($_hours *
> 60)\n" | bc -l`
>   _seconds=`printf "scale=0;$_time %% 60\n" | bc -l`
>
> printf "${_days:-0}D ${_hours:-0}H "
> printf "${_minutes:-0}M ${_seconds:-0}S\n"
>
> [root at NTP ~]# ./ntpd-uptime
> 1D 7H 56M 23S
>
>
>
> > -----Original Message-----
> > From: Dave Hart [mailto:hart at ntp.org]
> > Sent: Tuesday, 21 February 2012 1:53 PM
> > To: Mark C. Stephens
> > Subject: Re: [ntp:questions] ntp version 4.2.7p257-o
> >
> > yes
> >
> > On Tue, Feb 21, 2012 at 02:35, Mark C. Stephens <marks at non-stop.com.au>
> > wrote:
> > > What is the measurement, seconds?
> > >
> > > Sent from my iPad
> > >
> > > On 21/02/2012, at 12:36, "Dave Hart" <hart at ntp.org> wrote:
> > >
> > >> On Tue, Feb 21, 2012 at 00:54, Mark C. Stephens <marks at non-
> > stop.com.au> wrote:
> > >>> A feature request: NTPD uptime in hh:mm:ss?
> > >>
> > >> C:\bin\dig>ntpq -c sysstats pool-test.ntp.org
> > >> uptime:                 497426
> > >> sysstats reset:         497426
> > >> packets received:       407367100
> > >> current version:        303585168
> > >> older version:          90119976
> > >> bad length or format:   13653619
> > >> authentication failed:  279276
> > >> declined:               1046
> > >> restricted:             25269
> > >> rate limited:           54916625
> > >> KoD responses:          3132859
> > >> processed for time:     23864
> > >>
> > >> Cheers,
> > >> Dave Hart
> > >>
> > >
>
>
> _______________________________________________
> questions mailing list
> questions at lists.ntp.org
> http://lists.ntp.org/listinfo/questions
>


More information about the questions mailing list