09-13-2007
date +%s prints %s to the screen
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
As expr is used for integer calculations, which command is used for float calculations. (1 Reply)
Discussion started by: sharmavr
1 Replies
2. Shell Programming and Scripting
Hi All..
Does anyone have a useful function where I can enter two date/timestamps and it calculates the difference in time in hours, minutes and seconds between the 2?
Any feedback much appreciated. :D
Kind Regards
Satnam (1 Reply)
Discussion started by: satnamx
1 Replies
3. Shell Programming and Scripting
I am trying to do a shell script to monitor if any files went through in the last hour.
There is a script in cron that runs every sec checking to see if a file is there and ftp the file out of this folder.
Now I just want to add a block of code that will check to see no files went in the last... (3 Replies)
Discussion started by: jonathan184
3 Replies
4. UNIX for Advanced & Expert Users
I have script that runs based on time variables passed in the command line. The first command argument is a timer, in seconds, of how often to execute a certain loop in the script. The second command argument is the end time of the script, in military time. Below is an example of the command line:... (1 Reply)
Discussion started by: Nysif Steve
1 Replies
5. Shell Programming and Scripting
I am writting a script in the ksh shell and am trying to find a way to report the total execution time of the script without requiring the user to specify the time function when executing the script.
Does anyone have any examples they have used. I have been setting up two date variables (one at... (1 Reply)
Discussion started by: Omar Bacha
1 Replies
6. Shell Programming and Scripting
hi all,
was wondering if there is another way to do calculations in ksh scripts other than using bc ?? i am using a script to calculate average response time and my script errors out after running for a bit.
e.g code i am using :
averageTime=$(print "$totalTime / $numberOfEntries" |... (2 Replies)
Discussion started by: cesarNZ
2 Replies
7. Shell Programming and Scripting
HI
i have following problem,
i need to use split command to split files each should be cca 700 lines but i dont know how to inplement it in the scripts becasuse each time the origin file will be various size ,
any body got any idea
cheers (2 Replies)
Discussion started by: kvok
2 Replies
8. UNIX for Dummies Questions & Answers
Hello,
I have to turn:
Apple Inc.:325,64:329,57
into
Apple Inc.:325,64:329,57:3,93
3,93=329,57-325,64.
My code:
cat beurs.txt | sed 's/\(*\):\(*\),*\(*\):\(*\),\(*\)/\4\.\5-\2\.\3/' beurs.txt | bc| tr '.' ',' | sed 's/^-*,/0,/' > winstmarges.txt; paste -d: beurs.txt winstmarges.txt; rm... (5 Replies)
Discussion started by: ikke008
5 Replies
9. Shell Programming and Scripting
grep Quality abc.txt | awk -F"=" '{print $2}'
o/p is given as
70/70
49/70
I want in the below format (percentage format)
100%
70%
help me!!!!:confused::confused::confused:
---------- Post updated at 09:59 AM ---------- Previous update was at 09:57 AM ----------
Cell 01 -... (3 Replies)
Discussion started by: nikhil jain
3 Replies
10. UNIX for Beginners Questions & Answers
Hello. I'm writing an awk script that looks at a .csv file and calculates the weighted grade for each student based on the scores and categories in the file. I am able to get the script to run the only issue however is that the same score for each student is the same. I'm self-teaching myself the... (1 Reply)
Discussion started by: Eric7giants
1 Replies
LEARN ABOUT DEBIAN
log::log4perl::util::timetracker
Util::TimeTracker(3pm) User Contributed Perl Documentation Util::TimeTracker(3pm)
NAME
Log::Log4perl::Util::TimeTracker - Track time elapsed
SYNOPSIS
use Log::Log4perl::Util::TimeTracker;
my $timer = Log::Log4perl::Util::TimeTracker->new();
# equivalent to Time::HiRes::gettimeofday(), regardless
# if Time::HiRes is present or not.
my($seconds, $microseconds) = $timer->gettimeofday();
# reset internal timer
$timer->reset();
# return milliseconds since last reset
$msecs = $timer->milliseconds();
# return milliseconds since last call
$msecs = $timer->delta_milliseconds();
DESCRIPTION
This utility module helps tracking time elapsed for PatternLayout's date and time placeholders. Its accuracy depends on the availability of
the Time::HiRes module. If it's available, its granularity is milliseconds, if not, seconds.
The most common use of this module is calling the gettimeofday() method:
my($seconds, $microseconds) = $timer->gettimeofday();
It returns seconds and microseconds of the current epoch time. If Time::HiRes is installed, it will simply defer to its gettimeofday()
function, if it's missing, time() will be called instead and $microseconds will always be 0.
To measure time elapsed in milliseconds, use the reset() method to reset the timer to the current time, followed by one or more calls to
the milliseconds() method:
# reset internal timer
$timer->reset();
# return milliseconds since last reset
$msecs = $timer->milliseconds();
On top of the time span between the last reset and the current time, the module keeps track of the time between calls to
delta_milliseconds():
$msecs = $timer->delta_milliseconds();
On the first call, this will return the number of milliseconds since the last reset(), on subsequent calls, it will return the time elapsed
in milliseconds since the last call to delta_milliseconds() instead. Note that reset() also resets the time of the last call.
The internal timer of this module gets its time input from the POSIX time() function, or, if the Time::HiRes module is available, from its
gettimeofday() function. To figure out which one it is, use
if( $timer->hires_available() ) {
print "Hooray, we get real milliseconds!
";
} else {
print "Milliseconds are just bogus
";
}
For testing purposes, a different time source can be provided, so test suites can simulate time passing by without actually having to wait:
my $start_time = time();
my $timer = Log::Log4perl::Util::TimeTracker->new(
time_function => sub {
return $start_time++;
},
);
Every call to $timer->epoch() will then return a time value that is one second ahead of the the value returned on the previous call. This
also means that every call to delta_milliseconds() will return a value that exceeds the value returned on the previous call by 1000.
COPYRIGHT AND LICENSE
Copyright 2002-2009 by Mike Schilli <m@perlmeister.com> and Kevin Goess <cpan@goess.org>.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.1 2010-07-21 Util::TimeTracker(3pm)