Sponsored Content
Top Forums Shell Programming and Scripting Subtract Seconds from Date Command Post 302951820 by Don Cragun on Tuesday 11th of August 2015 03:07:44 AM
Old 08-11-2015
What operating system and shell are you using?

Please explain more clearly what you are trying to do? Are you saying that you want to synchronize the clock on your system to run 5 seconds behind the time used by rest of the world?
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Subtract two date in unix

I Have a long file like this 123122312 05/06/12 123123456 05/06/14 I want to take the difference of dates in two lines & print difference sidewise for the whole long files. Pl help me out. (1 Reply)
Discussion started by: vanand
1 Replies

2. UNIX for Advanced & Expert Users

Subtract 2 months from the date

I have the script which appends month and year to the name of the file. Now every time when I append the month-year combination I have to subtract 2 months from the current date and then append it, since we are sending our vendor 2 months prior worth of data eveytime. #! /usr/bin/ksh ... (5 Replies)
Discussion started by: mahekr2000
5 Replies

3. HP-UX

a simple way of converting a date in seconds to normal date

Hi all! I'm working on a HPUX system, and I was wondering if there is a simple way to convert a date from seconds (since 1970) to a normal date. Thanks (2 Replies)
Discussion started by: travian
2 Replies

4. Shell Programming and Scripting

Add or Subtract the hours,minutes or seconds in the the time variable

Hello All, I am working on script where I need to add hours,minutes or seconds in the time.Time is not the current but it could be future time.I thought I can store that time in variable and add hours.minutes or second but I am not able to add that in the time that is stores in a variable. Time... (9 Replies)
Discussion started by: anuragpgtgerman
9 Replies

5. Shell Programming and Scripting

Date command - subtract from given time

the given time is: 12:13:00 how do i subtract a 10 minutes from any given time? date '12:13:00' '-10 min' also tried this: date +12:13:00 '-10 min' (2 Replies)
Discussion started by: SkySmart
2 Replies

6. Shell Programming and Scripting

Subtract date in a loop

I have a file with name and date--- $ cat file.log userA 01-06-2014 userB 25-05-2014 userC 16-05-2014 userC 01-03-2014 I want to search for the current date and get the name for that date. If current date is not found, go back 1 day and search and so on till it finds the... (2 Replies)
Discussion started by: Nagesh_1985
2 Replies

7. UNIX for Dummies Questions & Answers

Subtract minutes from date

Hi, I am reading a particular date from a file using below command WFLWDATE=$(sed '2q;d' FileA.prm) The echo command outputs the correct date in variable WFLWDATE Now I want to subtract 5 minutes from this variable. I am on AIX and unable to get anything working as expected. Can you... (1 Reply)
Discussion started by: vrupatel
1 Replies

8. Shell Programming and Scripting

Subtract a file's modification date with current date

SunOS -s 5.10 Generic_147440-04 sun4u sparc SUNW,SPARC-Enterprise Hi, In a folder, there are files. I have a script which reads the current date and subtract the modification date of each file. How do I achieve this? Regards, Joe (2 Replies)
Discussion started by: roshanbi
2 Replies

9. HP-UX

awk command in hp UNIX subtract 30 days automatically from current date without date illegal option

current date command runs well awk -v t="$(date +%Y-%m-%d)" -F "'" '$1 < t' myname.dat subtract 30 days fails awk -v t="$(date --date="-30days" +%Y-%m-%d)" -F "'" '$1 < t' myname.dat awk command in hp unix subtract 30 days automatically from current date without date illegal option error... (20 Replies)
Discussion started by: kmarcus
20 Replies
clocks(2)							System Calls Manual							 clocks(2)

NAME
clock_settime(), clock_gettime(), clock_getres() - clock operations SYNOPSIS
DESCRIPTION
clock_settime() The function sets the specified clock, to the value specified by Time values that are between two consecutive non-negative integer multi- ples of the resolution of the specified clock are truncated down to the smaller multiple of the resolution. clock_gettime() The function returns the current value for the specified clock, clock_getres() The resolution of any clock can be obtained by calling Clock resolutions are implementation defined and are not settable by a process. If the argument is not NULL, the resolution of the specified clock is stored into the location pointed to by If is NULL, the clock resolution is not returned. A clock may be system wide, that is, visible to all processes; or per-process, measuring time that is meaningful only within a process. The following clocks are supported: This clock represents the realtime clock for the system. For this clock, the values returned by and specified by represent the amount of time (in seconds and nanoseconds) since the Epoch. It is a system wide clock. The privilege is required to set this clock. Processes owned by the superuser have this privilege. Processes owned by other users may have this privilege, depending on system configuration. See privileges(5) for more information about privileged access on systems that support fine-grained privileges. This clock represents the amount of time (in seconds and nanoseconds) that the calling process has spent executing code in the user's context. It is a per-process clock. It cannot be set by the user. This clock represents the amount of time (in seconds and nanoseconds) that the calling process has spent executing code in both the user's context and in the operating system on behalf of the calling process. It is a per-process clock. It cannot be set by the user. These clocks are high resolution hardware clocks present on HP-RT realtime systems. It is included here so that applications accessing this hardware can be compiled on HP-UX systems and then ported to an HP-RT target. HP-UX does not support or RETURN VALUE
A return of zero indicates that the call succeeded. A return value of -1 indicates that an error occurred, and is set to indicate the error. ERRORS
If any of the following conditions occur, the and functions return -1 and set (see errno(2)) to the corresponding value: The functions and are not supported by this implementation. The argument does not specify a known clock. The argument to is outside the range for the given The argument specified a nanosecond value less than zero or greater than or equal to 1000 million. The requesting process does not have the necessary privileges to set the specified clock. The or argument points to an invalid address. EXAMPLES
Advance the system wide realtime clock approximately one hour: Get the resolution of the user profiling clock: AUTHOR
and were derived from the proposed IEEE POSIX P1003.4 Standard, Draft 14. SEE ALSO
timers(2), privileges(5). STANDARDS CONFORMANCE
clocks(2)
All times are GMT -4. The time now is 08:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy