Operating System - HP-UX
1833587 Members
4265 Online
110061 Solutions
New Discussion

RCP behaviour when time misalignment between source and destination

 
SOLVED
Go to solution
Enrico Venturi
Super Advisor

RCP behaviour when time misalignment between source and destination

Hi all,
we use rcp with "-p" option, which should keep the proper file owner/groups and data.
The source machine date is 2 hours after the destination one.
We remote copy a file which date is 12.00.
The destination time is 10.00 ... after the copy on the destination the file date is "2001", i.e. no date has been assigned, because the HP UX isn't able to manage a date "after" the current one.
If the source date is only few minutes after the destination one, then the destination machine can manage the time (i.e. 10:15 when the date is 10:00).
What is the maximum time misalignment supported (managed) by the HP UX in the context of a file remote copy?

thanks in advance
5 REPLIES 5
Steven Gillard_2
Honored Contributor
Solution

Re: RCP behaviour when time misalignment between source and destination

I think you'll find the time is indeed being set correctly. I assume you're using ls -l (or ll) to view the date? The ls -l command has some logic which decides whether the modification time of the file is in the current 24 hour period or not, and obviously when the mod time is greater than the system time this logic is confused. Hence ls -l displays the mod time in date-only format without the time.

I'll bet that when the time on the destination system catches up to the mod time of the file, ls -l will display the time as you expect.

Cheers,
Steve
Enrico Venturi
Super Advisor

Re: RCP behaviour when time misalignment between source and destination

Steve, you're rigth: I use ll.
Which command can be used to check if the date is set/kept correctly?
harry d brown jr
Honored Contributor

Re: RCP behaviour when time misalignment between source and destination

It should be able to handle date/time into the future until the 32bit limit is reached (Tue Jan 19 03:14:07 2038 - where one second past it is Fri Dec 13 20:45:52 1901). BTW I hope everyone is planning on getting their systems up to date by then :-))))

live free or die
harry
Live Free or Die
Steven Gillard_2
Honored Contributor

Re: RCP behaviour when time misalignment between source and destination

Try this simple perl script. It takes a directory name as the argument and prints out a list of files in that directory with their corresponding mod time's.

#!/opt/perl5/bin/perl

opendir(DIR, $ARGV[0])
or die "could not open directory $ARGV[0]: $!";

while (defined($filename = readdir(DIR))) {
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks) = stat($filename);

($sec,$min,$hour,$mday,$mon,$year,@rest) = localtime($mtime);

printf("%02d:%02d:%02d %02d/%02d/%04d %s\n",
$hour, $min, $sec, $mday, $mon+1, $year+1900, $filename);
}
closedir(DIR);

Cheers,
Steve
Darrell Allen
Honored Contributor

Re: RCP behaviour when time misalignment between source and destination

Hi,

I've been bitten by the same thing several times. If the source system's clock is ahead of the destination's, the timestamp on the file will show the year until the destination system's clock catches up.

NTP is nice for keeping the system clock syncronized to a time server. There are several public time servers available but if your company has a firewall (they should) you may not be able to get to the public servers without having a port opened. Of course, you're company may have an NTP time source.

Harry, I'm glad I'll be retired by 2038!

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)