Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Please Help ( Calculate time taken in a script) Post 7755 by sskb on Monday 1st of October 2001 05:50:18 PM
Old 10-01-2001
Lightbulb

hi!
i think u can use the timex command. for more details just go thru the "man".Smilie
sskb
 

10 More Discussions You Might Find Interesting

1. AIX

calculate time

Hi, How do I calculate time? I need to create an alert if a process is running more than 30 minutes. I need to get the first time and then get another, calculate it if more than 30 mins and then alert it to pager. Can't find it in internet. Thanks in advance, itik (2 Replies)
Discussion started by: itik
2 Replies

2. Shell Programming and Scripting

How to calculate the time difference.

Hi All, I've written a script which reads all the systems backup information and saves it in a log file. ssh -l ora${sid} ${primaryhost} "tail -1 /oracle/$ORACLE_SID/sapbackup/back$ORACLE_SID.log" | awk '{print $3,$4,$5,$6}' >> ${RESULTFILE} The output comes as below: 2008-09-30 06.00.01... (2 Replies)
Discussion started by: suri.tyson
2 Replies

3. UNIX for Dummies Questions & Answers

calculate the time

hello i want to display the time firstly when i run my shell script and after 25 min i want to display a message it says that the time left is 5 min. When the calculated time is 30 mins, the script should exit. can any one help me with that! Thanks in advance Regards :o (5 Replies)
Discussion started by: dndoon
5 Replies

4. Programming

Calculate time to some date

Hello! I need to find how many days, hours and minutes remain to some specific date and I wonder why the following program shows incorrect values, such as 4 days 23 hours etc to 14:00 this Saturday from 17:33 today... #include <stdio.h> #include <time.h> int main() { time_t elaps,... (4 Replies)
Discussion started by: Sapfeer
4 Replies

5. Shell Programming and Scripting

Calculate average time using a script

Hello, I'm hoping to get some help on calculating an average time from a list of times (hour:minute:second). Here's what my list looks like right now, it will grow (I can get the full date or change the formatting of this as well): 07:55:31 09:42:00 08:09:02 09:15:23 09:27:45 09:49:26... (4 Replies)
Discussion started by: jaredhanks
4 Replies

6. Shell Programming and Scripting

How to calculate time difference between start and end time of a process!

Hello All, I have a problem calculating the time difference between start and end timings...! the timings are given by 24hr format.. Start Date : 08/05/10 12:55 End Date : 08/09/10 06:50 above values are in mm/dd/yy hh:mm format. Now the thing is, 7th(08/07/10) and... (16 Replies)
Discussion started by: smarty86
16 Replies

7. Shell Programming and Scripting

Calculate age of a file | calculate time difference

Hello, I'm trying to create a shell script (#!/bin/sh) which should tell me the age of a file in minutes... I have a process, which delivers me all 15 minutes a new file and I want to have a monitoring script, which sends me an email, if the present file is older than 20 minutes. To do... (10 Replies)
Discussion started by: worm
10 Replies

8. Shell Programming and Scripting

How to calculate time

Hello Guys, I am trying to calculate total hours and minutes a given user has used the system since the beginning of the current month. #!/usr/bin/sh hr=0 min=0 last $1 | grep -w `date "+%b"` | grep -v '\(0:.*\)' | grep -vw sshd | cut -c 66- | tr -d "\(\)" | cut -f1 -d ":" | grep -v '.*' |... (9 Replies)
Discussion started by: kasparov
9 Replies

9. Shell Programming and Scripting

Calculate time difference

I have time in a file in HH:MM:SS format as it contents(its not the file creation time). i need this to be converted to epoch time or time since 1970. The time is written into that file by a script, which i cannot modify. Im using AIX machine $ cat abc.txt 10:29:34 (2 Replies)
Discussion started by: gpk_newbie
2 Replies

10. Shell Programming and Scripting

Calculate Time diff in milli milliseconds(Time format : HH:MM:SS,NNN)

Hi All, I have one file which contains time for request and response. I want to calculate time difference in milliseconds for each line. This file can contain 10K lines. Sample file with 4 lines. for first line. Request Time: 15:23:45,255 Response Time: 15:23:45,258 Time diff... (6 Replies)
Discussion started by: Raza Ali
6 Replies
ADJTIMEX(2)						     Linux Programmer's Manual						       ADJTIMEX(2)

NAME
adjtimex - tune kernel clock SYNOPSIS
#include <sys/timex.h> int adjtimex(struct timex *buf); DESCRIPTION
Linux uses David L. Mills' clock adjustment algorithm (see RFC 1305). The system call adjtimex() reads and optionally sets adjustment parameters for this algorithm. It takes a pointer to a timex structure, updates kernel parameters from field values, and returns the same structure with current kernel values. This structure is declared as follows: struct timex { int modes; /* mode selector */ long offset; /* time offset (usec) */ long freq; /* frequency offset (scaled ppm) */ long maxerror; /* maximum error (usec) */ long esterror; /* estimated error (usec) */ int status; /* clock command/status */ long constant; /* pll time constant */ long precision; /* clock precision (usec) (read-only) */ long tolerance; /* clock frequency tolerance (ppm) (read-only) */ struct timeval time; /* current time (read-only) */ long tick; /* usecs between clock ticks */ }; The modes field determines which parameters, if any, to set. It may contain a bitwise-or combination of zero or more of the following bits: #define ADJ_OFFSET 0x0001 /* time offset */ #define ADJ_FREQUENCY 0x0002 /* frequency offset */ #define ADJ_MAXERROR 0x0004 /* maximum time error */ #define ADJ_ESTERROR 0x0008 /* estimated time error */ #define ADJ_STATUS 0x0010 /* clock status */ #define ADJ_TIMECONST 0x0020 /* pll time constant */ #define ADJ_TICK 0x4000 /* tick value */ #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime() */ Ordinary users are restricted to a zero value for mode. Only the superuser may set any parameters. RETURN VALUE
On success, adjtimex() returns the clock state: #define TIME_OK 0 /* clock synchronized */ #define TIME_INS 1 /* insert leap second */ #define TIME_DEL 2 /* delete leap second */ #define TIME_OOP 3 /* leap second in progress */ #define TIME_WAIT 4 /* leap second has occurred */ #define TIME_BAD 5 /* clock not synchronized */ On failure, adjtimex() returns -1 and sets errno. ERRORS
EFAULT buf does not point to writable memory. EINVAL An attempt is made to set buf.offset to a value outside the range -131071 to +131071, or to set buf.status to a value other than those listed above, or to set buf.tick to a value outside the range 900000/HZ to 1100000/HZ, where HZ is the system timer interrupt frequency. EPERM buf.mode is nonzero and the caller does not have sufficient privilege. Under Linux the CAP_SYS_TIME capability is required. CONFORMING TO
adjtimex() is Linux-specific and should not be used in programs intended to be portable. See adjtime(3) for a more portable, but less flexible, method of adjusting the system clock. SEE ALSO
settimeofday(2), adjtime(3), capabilities(7), time(7) COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2004-05-27 ADJTIMEX(2)
All times are GMT -4. The time now is 08:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy