Sponsored Content
Top Forums UNIX for Dummies Questions & Answers how to find difference of 2 timestamps in secs? Post 302178054 by Alecs on Monday 24th of March 2008 12:36:17 PM
Old 03-24-2008
how to find difference of 2 timestamps in secs?

I have a requirement to find the time difference in second between 2 given time stamps. An example scenario is shown below:

30 Oct 11:42:29:992 DEBUG org.apache.commons.digester.Digester - New match='form-validation/global/validator' (IID=, TID=)

30 Oct 11:42:29:993 DEBUG org.apache.commons.digester.Digester - Fire begin() for SetPropertiesRule[] (IID=, TID=)

30 Oct 11:42:29:994 DEBUG org.apache.commons.digester.Digester.sax - endElement(,validator,validator) (IID=, TID=)

30 Oct 11:42:29:994 DEBUG org.apache.commons.digester.Digester - bodyText='' (IID=, TID=)

30 Oct 11:42:29:995 DEBUG org.apache.commons.digester.Digester - Popping body text '' (IID=, TID=)

30 Oct 11:42:29:999 DEBUG org.apache.commons.digester.Digester - Fire end() for SetPropertiesRule[] (IID=, TID=)

30 Oct 11:42:29:999 DEBUG org.apache.commons.digester.Digester.sax - startElement(,validator,validator) (IID=, TID=)

30 Oct 11:42:30:000 DEBUG org.apache.commons.digester.Digester - Pushing body text '' (IID=, TID=)

30 Oct 11:42:30:000 DEBUG org.apache.commons.digester.Digester - Fire begin() for SetPropertiesRule[] (IID=, TID=)

30 Oct 11:42:30:001 DEBUG org.apache.commons.digester.Digester - match='form-validation/global/validator' (IID=, TID=)

30 Oct 11:42:30:001 DEBUG org.apache.commons.digester.Digester - bodyText='' (IID=, TID=)

30 Oct 11:42:30:001 DEBUG org.apache.commons.digester.Digester - Fire body() for SetPropertiesRule[] (IID=, TID=)


I want to get the time difference of the date field of the last line (30 Oct 11:42:30:001) and that of the first line (30 Oct 11:42:29:992) in seconds. That should work correctly across days and across years also. Can someone please help me solving this issue?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find command to get the timestamps

I want to have the timestamps of the files containing a specific string in them. I have tried using different combinations of find command and grep and ls but not giving the desired output. find $HOME/bin/shells -name "*" -print -exec ls -Flt {} -exec grep -i "abc" '{}' \; Please help. (8 Replies)
Discussion started by: nguda
8 Replies

2. UNIX for Dummies Questions & Answers

find command not giving file names accord. to timestamps

Currently iam working on solaris environment, Iam using find command to get list of all files between any two given dates. But the find command is not listing files accord. to timestamp. I tried using -exec option as -exec ls -ltr {} \; Still the files are not listed according to timestamp..... (8 Replies)
Discussion started by: thanuman
8 Replies

3. Solaris

Difference between two timestamps

I'm writting a script to find the difference between two timestamp. One field i get on delivery time of the file like 07:17 AM and other is my SLA time 06:30 AM I need to find the difference between these two time (time exceeded to meet SLA). Need some suggestions. (8 Replies)
Discussion started by: raman1605
8 Replies

4. Shell Programming and Scripting

ls -e to find out File modification time in secs

Hi All, I would like to know the file modification time till seconds in Unix. So I tried ls -e and it worked fine. This Solaris 5.10 -rw-rw-r-- 1 test admin 22 Sep 12 11:01:37 2008 test_message But I am not able to run the same command in SOlaris 5.6 and also in AIX/HP Is there... (3 Replies)
Discussion started by: rahulkav
3 Replies

5. Shell Programming and Scripting

Difference between two timestamps Contd..

There was this thread earlier with the same name and the solution provided was excellent. Here is the solution to find diffrenc between two timestamp $ cat timestamp #! /usr/bin/ksh echo enter first time stamp read TIME1 echo enter second time stamp read TIME2 H1=${TIME1%:+()}... (3 Replies)
Discussion started by: Shellslave
3 Replies

6. AIX

How to find time difference between 2 timestamps?

HI All, can some one please help me how to fine the difference between two time stamps say a= Nov 10, 2009 9:21:25 AM b= Nov 10, 2009 10:21:25 AM I want to find difference between the a & b I googled and tried with some options but no luck. My OS is AIX (1 Reply)
Discussion started by: bandlan9
1 Replies

7. Shell Programming and Scripting

Calculate difference in timestamps based on unique column value

Hi Friends, Require a quick help to write the difference between 2 timestamps based on a unique column value: Input file: 08/23/2012 12:36:09,JOB_5340,08/23/2012 12:36:14,JOB_5340 08/23/2012 12:36:22,JOB_5350,08/23/2012 12:36:26,JOB_5350 08/23/2012 13:08:51,JOB_5360,08/23/2012... (4 Replies)
Discussion started by: asnandhakumar
4 Replies

8. Shell Programming and Scripting

Finding difference in 2 different timestamps

Legends, I have a requirement to run the script exactly after one hour of completion of dependent script. Eg: Script B should run after one hour on the completion of Script A. I got the time stamps using following variables. these scripts runs in autosys > DATE=`date +%H:%M` >... (4 Replies)
Discussion started by: sdosanjh
4 Replies

9. Shell Programming and Scripting

Find matching timestamps in two files.

OK. if the first file is : 3184 2014-07-28 04:15 global.Remote-Access 10.111.8.25 81.245.6.25 tcp 3268 3035 2014-07-28 04:16 global.Remote-Access 10.111.8.12 81.245.6.25 tcp 3268If the second file is: 1 Jul 28 04:12 2014-07-28 id967254(BGC-TLW-Cert) Tunneling: User with IP... (8 Replies)
Discussion started by: fxsme
8 Replies

10. Shell Programming and Scripting

Find file between timestamps Query

On my linux box, I have a file say dump.txt. I then need to move to another seperte folder and need to find only one file with extension *.tar that has the closest timestamp after / next to the timestamp of the dump.txt. (2 Replies)
Discussion started by: mohtashims
2 Replies
apache(1M)                                                System Administration Commands                                                apache(1M)

NAME
apache - Apache hypertext transfer protocol server overview DESCRIPTION
apache consists of a main server daemon, loadable server modules, some additional support utilities, configuration files, and documenta- tion. FILES
The apache HTTPD server is integrated with Solaris. The following files specify the installation locations for apache: /etc/apache Contains server configuration files. A newly-installed server must be manually configured before use. Typically this involves copying httpd.conf-example to the httpd.conf file and making local configuration adjustments. /usr/apache/bin Contains the httpd executable as well as other utility programs. /usr/apache/htdocs Contains the Apache manual in HTML format. This documentation is accessible by way of a link on the server test page that gets installed upon fresh installation. /usr/apache/include Contains the Apache header files, which are needed for building various optional server extensions with apxs(8) /usr/apache/jserv Contains documention for the mod_jserv java servlet module. Documention can be read with a web browser using the url: file:/usr/apache/jserv/docs/index.html /usr/apache/libexec Contains loadable modules (DSOs) supplied with the server. Any modules which are added using apxs(8)are also copied into this directory. /usr/apache/man Contains man pages for the server, utility programs, and mod_perl. Add this directory to your MANPATH to read the Apache man pages. See NOTES. /usr/apache/perl5 Contains the modules and library files used by the mod_perl extension to Apache. /var/apache/cgi-bin Default location for the CGI scripts. This can be changed by altering the httpd.conf file and restarting the server. /var/apache/htdocs Default document root. This can be changed by altering the httpd.conf file and restarting the server. /var/apache/icons Icons used by the server. This normally shouldn't need to be changed. /var/apache/logs Contains server log files. The formats, names, and locations of the files in this directory can be altered by various configuration directives in the httpd.conf file. /var/apache/proxy Directory used to cache pages if the caching feature of mod_proxy is enabled in the httpd.conf file. The location of the cache can also be changed by changing the proxy configuration in the httpd.conf file. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWapchr | +-----------------------------+-----------------------------+ | |SUNWapchu | +-----------------------------+-----------------------------+ | |SUNWapchd | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) http://www.apache.org NOTES
In addition to the documentation and man pages included with Solaris, more information is available at http://www.apache.org The Apache man pages are provided with the programming modules. To view the manual pages for the Apache modules with the man command, add /usr/apache/man to the MANPATH environment variable. See man(1) for more information. Running catman(1M) on the Apache manual pages is not supported. SunOS 5.10 8 Aug 2000 apache(1M)
All times are GMT -4. The time now is 06:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy