• Home (current)
  • वर्तमान निदेशक => /usr/bin/
  • सूचना एवं अपलोड
    Info Server
Indian Cyber Force
Folders रचयन्तु सञ्चिकां रचयन्तु RansomWeb लॉगआउट
Current File : //usr/bin/calc_tickadj
#! /usr/bin/perl -w
#
# drift of 104.8576 -> +1 tick.  Base  of 10000 ticks.
#
# 970306 HMS Deal with nanoseconds.  Fix sign of adjustments.
package calc_tickadj;
use strict;

exit run(@ARGV) unless caller;

sub run {
    my $opts;
    if (!processOptions(\@_, $opts)) {
        usage(1);
    };
    my $drift_file = $opts->{'drift-file'};
    my $tick       = $opts->{'tick'};

    if (!$tick) {
        my ($fl) = `tickadj`;
        if (defined $fl && $fl =~ /(?:KERNEL|PRESET)?\s*tick\s+=\s+(\d+)/) {
            $tick = $1;
        }
        else {
            die "Could not get tick value, try manually with -t/--tick\n";
        }
    }

    # Drift file is in PPM where Milion is actually 2**20
    my $cvt   = (2 ** 20) / $tick;
    my $drift = 0.;

    open my $dfh, $drift_file or die "Could not open $drift_file: $!\n";

    $drift = <$dfh>; 

    close $dfh;
    die "Invalid drift file value <$drift>" if $drift !~ /[+-]?\d+\.?[0-9]+/;

    while ($drift < 0) {
        $drift += $cvt;
        $tick--;
    }

    while ($drift > $cvt) {
        $drift -= $cvt;
        $tick++;
    }

    printf "%.3f (drift)\n", $drift;
    printf "%d usec; %d nsec\n", $tick, ($tick + ($drift/$cvt)) * 1000;

    return 0;
}

# EDIT THIS FILE WITH CAUTION  (calc_tickadj-opts)
#
# It has been AutoGen-ed  April  5, 2019 at 01:12:39 AM by AutoGen 5.18.5
# From the definitions    calc_tickadj-opts.def
# and the template file   perlopt

use Getopt::Long qw(GetOptionsFromArray);
Getopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always));

my $usage;

sub usage {
    my ($ret) = @_;
    print STDERR $usage;
    exit $ret;
}

sub paged_usage {
    my ($ret) = @_;
    my $pager = $ENV{PAGER} || '(less || more)';

    open STDOUT, "| $pager" or die "Can't fork a pager: $!";
    print $usage;

    exit $ret;
}

sub processOptions {
    my $args = shift;

    my $opts = {
        'drift-file' => '/etc/ntp/drift',
        'tick' => '',
        'help' => '', 'more-help' => ''
    };
    my $argument = '';
    my $ret = GetOptionsFromArray($args, $opts, (
        'drift-file|d=s', 'tick|t=i',
        'help|?', 'more-help'));

    $usage = <<'USAGE';
calc_tickadj - Calculates "optimal" value for tick given ntp drift file. - Ver. 4.2.8p13
USAGE: calc_tickadj [ -<flag> [<val>] | --<name>[{=| }<val>] ]... 

    -d, --drift-file=str         Ntp drift file to use
    -t, --tick=num               Tick value of this host
    -?, --help                   Display usage information and exit
        --more-help              Pass the extended usage text through a pager

Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
USAGE

    usage(0)       if $opts->{'help'};
    paged_usage(0) if $opts->{'more-help'};
    $_[0] = $opts;
    return $ret;
}

END { close STDOUT };

1;
__END__
gorilla – Verilere bak
Menu
  • Top 10

Verilere bak

Follow us
  • facebook
  • twitter
Search
Login
Create
Menu

Verilere bak

Login

You are here:

  1. Home
  2. Tag Archives: gorilla

gorilla

Latest stories

Can You Get Through These 12 Sexy Photos Without Saying WOW? (Open list)

  • facebook
  • twitter

Arşivler

Kategoriler

Disclaimer

This demo site is only for demonstration purposes. All images are copyrighted to their respective owners. All content cited is derived from their respective sources.

© 2017 bring the pixel. Remember to change this

  • Home
  • Contact us
Back to Top
Close
  • Top 10
  • Home
  • Animals
  • Funny
  • WOW
  • WTF
  • Features
  • facebook
  • twitter
Create

Log In

Sign In

Forgot password?

Forgot password?

Enter your account data and we will send you a link to reset your password.

Back to Login

Your password reset link appears to be invalid or expired.

Log in

Privacy Policy

Accept

Add to Collection

  • Public collection title

  • Private collection title

No Collections

Here you'll find all collections you've created before.

Hey Friend!
Before You Go…

Get the best viral stories straight into your inbox before everyone else!

Don't worry, we don't spam

Close

Newsletter

Don’t miss out on new posts!

Don't worry, we don't spam

Close