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
Debian::Javahelper::Eclipse(3)					    Javahelper					    Debian::Javahelper::Eclipse(3)

NAME
Debian::Javahelper::Eclipse - Eclipse Helper Library. SYNOPSIS
use Debian::Javahelper::Eclipse; my @orbitdeps = (); push(@orbitdeps, { EOB_SYM_NAME => 'org.apache.commons.net', EOB_SYS_JAR => '/usr/share/java/commons-net2.jar'}); #... # Install the feature to "$dropins/$name" install_zipped_feature($zip, "$dropins/$name"); # and symlink the following orbitdeps. install_zipped_feature($zip, "$dropins/$name", @orbitdeps); DESCRIPTION
This module is used by the eclipse related javahelpers to share common code. Please note this API is not stable and backwards compatibility is not guaranteed at the current time. Please contact the maintainers if you are interested in a stable API. Definitions A bundle refers to a jar file. An orbit dependency (a.k.a orbitdep) is a bundle, which is used by eclipse or one of its features without being a part of eclipse or said feature. This module keeps track of bundles via hashes; see the EOB_* constants for relevant keys (and their expected values). Constants EOB_SYM_NAME Key for hashes to fetch the symbolic name of a bundle. EOB_BUNDLE_VERSION Key for hashes to fetch the version of a bundle. EOB_SYS_JAR Key for hashes to fetch the path to the system installed jar file. Only valid for an orbit dependency and cannot be used with manifests. Methods install_zipped_feature($fzip, $loc[, $orbitdeps[, $package, $needs]]) Unpacks the zipped feature $fzip into $loc, which should be a subfolder of a dropins folder (e.g. /usr/share/eclipse/dropins/emf). This can also be used to install the feature into a "build environment". In this case it should be installed into the same folder as the SDK is (this folder is usually called "SDK"). If $orbitdeps is present, it should be an ARRAY ref containing orbit dependencies, which will be symlinked after unpacking. This sub only needs the EOB_SYM_NAME and EOB_SYS_JAR to be set and valid. Orbit dependencies not present in the installed folder will be ignored, so it is safe to have unrelated orbit dependencies in the ARRAY ref. If $package and $needs are present, the former should be the name of a debian package and the latter a hashref. The sub will populate the $needs hashref with which orbit dependencies are used by the package. The $needs hashref can be re-used in multiple calls to this sub. Keys in $needs will be the path to the orbit jar's real location (EOB_SYS_JAR) and the value a new hashref. This hashref has as keys the names of packages and as values 1. The $needs is used by jh_installeclipse to populate the ${orbit:Depends} variables for packages. AUTHOR
Niels Thykier <niels@thykier.net> COPYRIGHT AND LICENSE
Copyright 2010 by Niels Thykier This module is free software; you may redistribute it and/or modify it under the terms of GNU GPL 2. 0.43 2011-02-17 Debian::Javahelper::Eclipse(3)
All times are GMT -4. The time now is 03:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy