- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Are there any tools or scripts available that will...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 08:21 AM
03-08-2002 08:21 AM
Example:
# elapsed 20020301 12:22:00 20020302 12:23:00
Elapsed time: 24 Hour(s} 1 minute(s) 0 Seconds(0)
# elapsed 12:23:00 12:44:01
Elapsed time: 1 Minute(s) 1 Second(s)
I could do this on Tandem and would like to do the same on HP-UX. Using the time command requires it being part of the script.
Thanks... jack...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 08:29 AM
03-08-2002 08:29 AM
Re: Are there any tools or scripts available that will take two timestamps and return elapsed time?
Is this another job for your caljd.sh script? :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 08:29 AM
03-08-2002 08:29 AM
Re: Are there any tools or scripts available that will take two timestamps and return elapsed time?
timex - the command returns CPU (User and system) and real time for command that is specified.
ctime (a C function) - write a C program to return the ctime value for current time (number of seconds since the epoch), and use this in your calculations. I myself have written this C program before, so it can't be that hard. Unfortunately I wrote it for another company so had to leave it behind.
Share and Enjoy! Ian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 08:41 AM
03-08-2002 08:41 AM
Re: Are there any tools or scripts available that will take two timestamps and return elapsed time?
from man Date::Calc
Delta_DHMS
($Dd,$Dh,$Dm,$Ds) =
Delta_DHMS($year1,$month1,$day1, $hour1,$min1,$sec1,
$year2,$month2,$day2, $hour2,$min2,$sec2);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 08:45 AM
03-08-2002 08:45 AM
Re: Are there any tools or scripts available that will take two timestamps and return elapsed time?
Don't have C or perl background.
jack...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 09:09 AM
03-08-2002 09:09 AM
Re: Are there any tools or scripts available that will take two timestamps and return elapsed time?
a5:/pro/3gl/CPAN 119 > elapsed.pl 12:09:12 18:04:05
Elapsed time: 5 hour(s) 54 minute(s) 53 second(s)
a5:/pro/3gl/CPAN 120 > elapsed.pl 12:09:12 18:04:15
Elapsed time: 5 hour(s) 55 minute(s) 3 second(s)
a5:/pro/3gl/CPAN 121 > elapsed.pl 20020301 12:22:00 20020302 12:23:00
Elapsed time: 1 day(s) 0 hour(s) 1 minute(s) 0 second(s)
a5:/pro/3gl/CPAN 122 > elapsed.pl 12:23:00 12:44:01
Elapsed time: 21 minute(s) 1 second(s)
a5:/pro/3gl/CPAN 123 >
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 09:19 AM
03-08-2002 09:19 AM
Re: Are there any tools or scripts available that will take two timestamps and return elapsed time?
[8133]root@chldevh:/usr/local/bin # elapsed.pl 12:12:22 12:14:22
"use" may clash with future reserved word at /usr/local/bin/elapsed.pl line 4.
syntax error in file /usr/local/bin/elapsed.pl at line 4, next 2 tokens "use strict"
"use" may clash with future reserved word at /usr/local/bin/elapsed.pl line 6.
syntax error in file /usr/local/bin/elapsed.pl at line 8, next 2 tokens "\usage ("
Execution of /usr/local/bin/elapsed.pl aborted due to compilation errors.
[8134]root@chldevh:/usr/local/bin #
jack...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 09:30 AM
03-08-2002 09:30 AM
Re: Are there any tools or scripts available that will take two timestamps and return elapsed time?
Do you have the September applications nearby? Install newer perl please. (what's the version you use? 4.036?)
(And asign points to the answers, look at http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x316efd3f91d3d5118ff40090279cd0f9,00.html)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 09:46 AM
03-08-2002 09:46 AM
Re: Are there any tools or scripts available that will take two timestamps and return elapsed time?
...
Ha, ha, this is really funny, I guess you were invoking a Perl 4 interpreter,
send your complaint to HP...
What is the output of
perl -v
perl -e 'print "@INC\n"'
Have you installed the module Date::Calc from CPAN.
(even if, this will most likely require a Perl 5.X)
Btw, Date::Calc wouldn't even be necessary.
The use of localtime() and timelocal() from Time::Local which are both standard Perl functions/modules would suffice for Epoch seconds calculations.
But anyway, you would only be able to do integer seconds timings.
If you require milli or micro seconds you could install and use Time::HiRes from CPAN, but let procura explain to you how to install and use those modules ;-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 09:59 AM
03-08-2002 09:59 AM
SolutionI spent a few minutes doing a non Perl version although the Perl version (if you download and install the Date::Calc module from CPAN) will work nicely.
And yes Patrick, I do call the caljd.sh utility.
I attach this in two parts:
By the way, this version only does hrs, mins, and seconds so that extra days show up as hous but that seemed to follow your example.
Here is elapsed.sh.
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 10:00 AM
03-08-2002 10:00 AM
Re: Are there any tools or scripts available that will take two timestamps and return elapsed time?
Here is my universal date hammer (now where's your nail?) caljd.sh
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 10:59 AM
03-08-2002 10:59 AM
Re: Are there any tools or scripts available that will take two timestamps and return elapsed time?
Thanks to all and thanks for such quick responses.
Jack...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 11:05 AM
03-08-2002 11:05 AM
Re: Are there any tools or scripts available that will take two timestamps and return elapsed time?
perl -e "print '@INC\n'" returns
@INC
jack...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 12:27 PM
03-08-2002 12:27 PM
Re: Are there any tools or scripts available that will take two timestamps and return elapsed time?
jack...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 12:33 PM
03-08-2002 12:33 PM
Re: Are there any tools or scripts available that will take two timestamps and return elapsed time?
http://search.cpan.org/search?module=Date::Calc
For a general listing of ALL perl modules on CPAN:
http://www.cpan.org/modules/00modlist.long.html#Part2-ThePerl5M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2002 10:05 AM
03-11-2002 10:05 AM
Re: Are there any tools or scripts available that will take two timestamps and return elapsed time?
You can get all the good modules from the CPAN (comprehensive perl archive network).
It is an invaluable source of combined Perl programmers' efforts, and can save you many, many hours.
Patrick has pointed you already in the right direction.
Here especially you can get Date::Calc
http://www.cpan.org/modules/by-module/Date/
You can download every module and install it almost always using the same mantra:
1) unzip and untar tarball
2) cd to new directory
3) *read* the README to find out prerequisites
4) issue "perl Makefile.PL"
this will create a Makefile using the ExtUtils::MakeMaker module
5) make
6) make test
7) make isntall
(this step should be done as root to have the module installed in the sit_lib subdir under the perl tree)
*But* it can save you a lot of repetitive, manual downloading, making, installing if you use the module CPAN by Andreas K??nig
You first have to do a configuration run.
issue
perl -MCPAN -e shell
will get you ask you many questions which you interactively will have to answer.
If you are sitting behind a proxy/firewall like me, things can be a bit tricky (but CPAN module will ask you for that).
It may also help to download and install wget first and set the passive flag when you are behind a proxy.
The after all this unique work you simply install whole bundles like this
e.g.
cpan> install Bundle::LWP
and watch in admiration what the CPAN module is doing.
But first of all get and install a decent Perl version (e.g. 5.6.1)!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2002 10:31 AM
03-11-2002 10:31 AM
Re: Are there any tools or scripts available that will take two timestamps and return elapsed time?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2002 12:45 PM
03-11-2002 12:45 PM
Re: Are there any tools or scripts available that will take two timestamps and return elapsed time?
jack...