File created with wrong timestamp

Hi All,

We are working on solaris 10.

I create a file using touch command and when list the file, it does not shows the right timestamp.

                                                                      
-bash-3.2$ date                                                                  
Mon Jun 29 16:27:06 IST 2015                                                     
-bash-3.2$ touch abc                                                             
-bash-3.2$                                                                       
-bash-3.2$                                                                       
-bash-3.2$ ls -tlr abc                                                           
-rw-r-----   1 ecmsacc  ecmsgroup       0 Jun 29  2015 abc                       
-bash-3.2$ ls -ltre abc                                                          
-rw-r-----   1 ecmsacc  ecmsgroup       0 Jun 29 21:21:16 2015 abc               
-bash-3.2$                                                                       
-bash-3.2$ ls -ltrE abc                                                          
-rw-r-----   1 ecmsacc  ecmsgroup       0 2015-06-29 21:21:16.002139000 +0530 abc
-bash-3.2$                                                                       
-bash-3.2$ uname                                                                 
SunOS                                                                            
-bash-3.2$ uname -a                                                              
SunOS mohecms01 5.10 Generic_150401-09 i86pc i386 i86pc                          
-bash-3.2$                                                                       
-bash-3.2$ cat /etc/TIMEZONE                                                     
TZ=Asia/Calcutta                                                                 
CMASK=022                                                                        
-bash-3.2$                                                                       
-bash-3.2$   

Please suggest.

Where are you when you execute your commands?
On what kind of file system?

Just so we agree on your output, can you type it again but this time I suggest you type:

date;touch zz;ls -l zz

For it doesnt look like a timezone issue but more like 2 boxes not having the time since one says 27min and the other 21...

Is there an NFS mount involved here? I've seen odd results with those before where the two servers did not agree on the time. It was over 20 years ago and that is probably sorted by now, but I don't have available servers to set up and check.

Robin

Thanks Robin, The issue is coming only on the NFS mounted partition.
Please suggest

The issue isn't that it is NFS mounted (although the problem is made apparent because the file is mounted from a different machine), the issue is that the clock on the server where the file resides is a little bit ahead of the clock on the machine where you are running these commands. You can probably see the clock skew if you run the commands:

date
touch abc
ls -ltrE abc
date

For a good way to fix the problem run, ntpd on your machine and on all machines that act as file servers for any files you reference from your machine. (See man ntpd for details.)