Sponsored Content
Full Discussion: Timestamp comparison
Top Forums Shell Programming and Scripting Timestamp comparison Post 302160211 by Ygor on Monday 21st of January 2008 07:28:12 AM
Old 01-21-2008
Try...
Code:
#! /usr/bin/awk -f

$7 ~ /Started/ {
  m=split($1,st_split,".")}

$7 ~ /Completed/ {
  n=split($1,et_split,".")
  st = (st_split[1]*60*60) + (st_split[2]*60) + st_split[3]
  et = (et_split[1]*60*60) + (et_split[2]*60) + et_split[3]
  d = et - st
  if ( d < 0 ) {
    d += 24*60*60
  }
  if ( d > (15*60)) {
    printf "Duration %02d.%02d.%02s: %s\n", d/60/60, d/60%60, d%60, $0
  }
}

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Timestamp comparison of 2 files present in 2 different servers

Hi, I have 2 different log servers and logs are stored in both of them at varied times. Those servers have same files stored at different times. I want to retrieve the latest of the log files that are stored inthe servers. Say "file.log" is present on both servers, i want to check which of it is... (3 Replies)
Discussion started by: goutham4u
3 Replies

2. UNIX for Dummies Questions & Answers

Timestamp comparison

How do I compare 2 timestamps (ie... if 2008-02-13 10:48:58.502075 gt 2008-12-15 16:00:00.000000) (4 Replies)
Discussion started by: auzark
4 Replies

3. Shell Programming and Scripting

Comparison of a timestamp and mtime of a file

Hi, I am a beginner in shell scripting. Could any one help me out for below requirement. Its bit urgent. Problem scenario: 1) I have a predefined timestamp (Ex. 2011-03-010 10:10:20) 2) And I have files in a directory starting with 'a' (Ex. a_123.txt, a_124.txt) Expected solution: I... (1 Reply)
Discussion started by: itzsamz
1 Replies

4. Shell Programming and Scripting

Getting a relative timestamp from timestamp stored in a file

Hi, I've a file in the following format 1999-APR-8 17:31:06 1500 3 45 1999-APR-8 17:31:15 1500 3 45 1999-APR-8 17:31:25 1500 3 45 1999-APR-8 17:31:30 1500 3 45 1999-APR-8 17:31:55 1500 3 45 1999-APR-8 17:32:06 1500 3 ... (1 Reply)
Discussion started by: vaibhavkorde
1 Replies

5. UNIX for Dummies Questions & Answers

How to compare a file by its timestamp and store in a different location whenever timestamp changes?

Hi All, I am new to unix programming. I am trying for a requirement and the requirement goes like this..... I have a test folder. Which tracks log files. After certain time, the log file is getting overwritten by another file (randomly as the time interval is not periodic). I need to preserve... (2 Replies)
Discussion started by: mailsara
2 Replies

6. Shell Programming and Scripting

Identifying files with a timestamp greater than a given timestamp

I need to be able to identify files with file timestamps greater than a given timestamp. I am using the following solution, although it appears to compare files at the "seconds" granularity and I need it at the milliseconds. When I tested my solution, it missed files that had timestamps... (3 Replies)
Discussion started by: nkm0brm
3 Replies

7. Shell Programming and Scripting

Comparison of timestamp on ftp

Hello Need help with shell script There is are files on my ftp. They overwriting every hour from other places. ls -la /home/ftp/ -rw-r--r-- 1 ftp nogroup 2296 2012-08-11 12:59 G1.zip -rw-r--r-- 1 ftp nogroup 6676 2012-08-11 13:00 KRT1.zip -rw-r--r-- 1 ftp nogroup 5169... (3 Replies)
Discussion started by: ck80
3 Replies

8. Shell Programming and Scripting

To check timestamp in logfile and display lines upto 3 hours before current timestamp

Hi Friends, I have the following logfile. Currently time in india is 07/31/2014 12:33:34 and i have the following content in logfile. I want to display only those entries which contain string 'Exception' within last 3 hours. In this case, it would be the last line only I can get the... (12 Replies)
Discussion started by: srkmish
12 Replies

9. Shell Programming and Scripting

AIX : Need to convert UNIX Timestamp to normal timestamp

Hello , I am working on AIX. I have to convert Unix timestamp to normal timestamp. Below is the file. The Unix timestamp will always be preceded by EFFECTIVE_TIME as first field as shown and there could be multiple EFFECTIVE_TIME in the file : 3.txt Contents of... (6 Replies)
Discussion started by: rahul2662
6 Replies

10. Shell Programming and Scripting

Grep lines between last hour timestamp and current timestamp

So basically I have a log file and each line in this log file starts with a timestamp: MON DD HH:MM:SS SEP 15 07:30:01 I need to grep all the lines between last hour timestamp and current timestamp. Then these lines will be moved to a tmp file from which I will grep for particular strings. ... (1 Reply)
Discussion started by: nms
1 Replies
Net::GPSD3::Return::Unknown::Timestamp(3pm)		User Contributed Perl Documentation	       Net::GPSD3::Return::Unknown::Timestamp(3pm)

NAME
Net::GPSD3::Return::Unknown::Timestamp - Net::GPSD3 Return Base Class with Timestamp SYNOPSIS
package XXX; use base qw{Net::GPSD3::Return::Unknown::Timestamp}; DESCRIPTION
Provides a time, timestamp and datetime methods to a GPSD3 Return object. METHODS
time Seconds since the Unix epoch, UTC. The value may have a fractional part of up to .01sec precision. Note: In 2.96 (protocol 3.4) the TPV->time format changed from unix epoch to W3C, but this method attempts to hide that change from the user. Since the POSIX standard for the Unix epoch does not use leap seconds but GPS system does I do not recommend that you use this method for time display or storage. This method is purely here for backwards compatibility. timestamp W3C formated timestamp value either directly from the protocol >= 3.4 or calculated < 3.4. The value may have a fractional part of up to .01sec precision. Note: I expect that in protocol 3.5 the value will be passed directly as TPV->timestamp datetime Returns a DateTime object BUGS
Log on RT and Send to gpsd-dev email list SUPPORT
DavisNetworks.com supports all Perl applications including this package. Try gpsd-dev email list AUTHOR
Michael R. Davis CPAN ID: MRDVT STOP, LLC domain=>michaelrdavis,tld=>com,account=>perl http://www.stopllc.com/ COPYRIGHT
This program is free software licensed under the... The BSD License The full text of the license can be found in the LICENSE file included with this module. SEE ALSO
Net::GPSD3, Net::GPSD3::Return::Unknown, DateTime::Format::W3CDTF, DateTime perl v5.14.2 2011-12-27 Net::GPSD3::Return::Unknown::Timestamp(3pm)
All times are GMT -4. The time now is 08:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy