12-23-2010
Since unix uses Epoch time ( the number of non-leap seconds since 00:00:00 UTC on January 1, 1970 ) it is quite normal on a same box...(Future is not yet written in history...).
Now if you have this sort of issue, IMHO either you have a bug in your copy/transfer application either a box has the wrong time set (They should all be using UTC and use TZ for local time).
But I might be wrong...
Last edited by vbe; 12-23-2010 at 06:36 AM..
Reason: typos
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have to capture the creation date and time stamp for a file. The ls command doesn't list all the required information. I need year, month, day, hour, minute and second.
Any ideas... (1 Reply)
Discussion started by: Xenon
1 Replies
2. Shell Programming and Scripting
I'm trying to write a script that checks the DTS of a file the compares it to the current time. If greater that 60 mins has gone by and the file has not been written to alert.
So far I have the time pulled from the file but I dont know how to compare the times against a 60 min difference.
... (2 Replies)
Discussion started by: jarich
2 Replies
3. UNIX for Dummies Questions & Answers
I am trying to insert a line with a date stamp in a file that is used to monitor activity in one of our directories. By doing this, I want to grep that file each day and go to the last entry for each time a error occurred and pull all errors generated if any exist. If error exists I want that error... (3 Replies)
Discussion started by: shephardfamily
3 Replies
4. UNIX for Dummies Questions & Answers
Hi All,
Wondering if there is have a date added at the end of a test string. I have a hypothetical text file day one:
John
Paul
George
When the file day one is output, I'd like it to read something like this:
John 101406
Paul 101406
George 101406
Day two, when the same text file... (0 Replies)
Discussion started by: JimmyFlip
0 Replies
5. Shell Programming and Scripting
Looking for a shell script or a simple perl script . I am new to scripting and not very good at it .
I have 2 directories . One of them holds a text file with list of files in it and the second one is a daily log which shows the file completion time. I need to co-relate both and make a report.
... (0 Replies)
Discussion started by: breez_drew
0 Replies
6. Shell Programming and Scripting
Hi
I use "touch -t xxxxxxxx" command to set date/time stamp of a file. My requirement is to read the date/time stamp of a file and apply it to another file.
Is there anyway to do it simple instead of manually taking date/stamp of first file?
TIA
Prvn (2 Replies)
Discussion started by: prvnrk
2 Replies
7. Shell Programming and Scripting
Hi!
Please see our current script:
#!/usr/bin/ksh
if (egrep "This string is found in the log" /a01/bpm.log)
then
mailx -s "Error from log" me@email.com, him@email.com </a01/bpm.log
fi
To the above existing script, we need to add the following change:
1) After finding the string,... (7 Replies)
Discussion started by: atechcorp
7 Replies
8. Shell Programming and Scripting
hi,
i have a Archive directory in which files are archived or stored with date and time stamp to prevent over writing.
example:
there are 5 files
s1.txt
s2.txt
s3.txt
s4.txt
s5.txt
while moving these files to archive directory, date and time stamp is added.
of format `date... (9 Replies)
Discussion started by: Little
9 Replies
9. Shell Programming and Scripting
I am developing one script which will take log file name, output file name, date, hour and minute as an argument and based on these inputs, the script will scan and capture all the error(s) that have been triggered from a given time. Example: script should capture all the error after 13:50 on Jan... (2 Replies)
Discussion started by: ROMA3
2 Replies
10. Shell Programming and Scripting
I have a file hello.txt which was created today (today's date timestamp)
I wish to change its date timestamp (access, modified, created) to 1 week old i.e one week from now.
uname -a
SunOS mymac 5.11 11.2 sun4v sparc sun4v
Can you please suggest a easy way to do that ? (12 Replies)
Discussion started by: mohtashims
12 Replies
LEARN ABOUT NETBSD
time2posix
TIME2POSIX(3) BSD Library Functions Manual TIME2POSIX(3)
NAME
time2posix, time2posix_z, posix2time, posix2time_z, -- convert seconds since the Epoch
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <time.h>
time_t
time2posix(time_t t);
time_t
time2posix_z(const timezone_t tz, time_t t);
time_t
posix2time(time_t t);
time_t
posix2time_z(const timezone_t tz, time_t t);
DESCRIPTION
IEEE Std 1003.1 (``POSIX.1'') legislates that a time_t value of 536457599 shall correspond to
Wed Dec 31 23:59:59 UTC 1986.
This effectively implies that POSIX time_t's cannot include leap seconds and, therefore, that the system time must be adjusted as each leap
occurs.
If the time package is configured with leap-second support enabled, however, no such adjustment is needed and time_t values continue to
increase over leap events (as a true `seconds since...' value). This means that these values will differ from those required by POSIX by the
net number of leap seconds inserted since the Epoch.
Typically this is not a problem as the type time_t is intended to be (mostly) opaque -- time_t values should only be obtained-from and
passed-to functions such as time(3), localtime(3), localtime_r(3), localtime_rz(3), mktime(3), mktime_z(3), and difftime(3). However, POSIX
gives an arithmetic expression for directly computing a time_t value from a given date/time, and the same relationship is assumed by some
(usually older) applications. Any programs creating/dissecting time_t's using such a relationship will typically not handle intervals over
leap seconds correctly.
The time2posix(), time2posix_z(), posix2time(), and posix2time_z() functions are provided to address this time_t mismatch by converting
between local time_t values and their POSIX equivalents. This is done by accounting for the number of time-base changes that would have
taken place on a POSIX system as leap seconds were inserted or deleted. These converted values can then be used in lieu of correcting the
older applications, or when communicating with POSIX-compliant systems.
time2posix() and time2posix_z() are single-valued. That is, every local time_t corresponds to a single POSIX time_t. posix2time() and
posix2time() are less well-behaved: for a positive leap second hit the result is not unique, and for a negative leap second hit the corre-
sponding POSIX time_t doesn't exist so an adjacent value is returned. Both of these are good indicators of the inferiority of the POSIX rep-
resentation.
The ``z'' variants of the two functions behave exactly like their counterparts, but they operate in the given tz argument which was previ-
ously allocated using tzalloc(3) and are re-entrant.
The following table summarizes the relationship between a time_t and its conversion to, and back from, the POSIX representation over the leap
second inserted at the end of June, 1993.
DATE TIME T X=time2posix(T) posix2time(X)
93/06/30 23:59:59 A+0 B+0 A+0
93/06/30 23:59:60 A+1 B+1 A+1 or A+2
93/07/01 00:00:00 A+2 B+1 A+1 or A+2
93/07/01 00:00:01 A+3 B+2 A+3
A leap second deletion would look like...
DATE TIME T X=time2posix(T) posix2time(X)
??/06/30 23:59:58 A+0 B+0 A+0
??/07/01 00:00:00 A+1 B+2 A+1
??/07/01 00:00:01 A+2 B+3 A+2
[Note: posix2time(B+1) => A+0 or A+1]
If leap-second support is not enabled, local time_t's and POSIX time_t's are equivalent, and both time2posix() and posix2time() degenerate to
the identity function.
SEE ALSO
difftime(3), localtime(3), localtime_r(3), localtime_rz(3), mktime(3), mktime_z(3), time(3), tzalloc(3)
BSD
December 4, 2010 BSD