Operating System - HP-UX
1834926 Members
2392 Online
110071 Solutions
New Discussion

Re: Why Time stamp format differs !!

 
SOLVED
Go to solution
Ezhilarasan
Occasional Advisor

Why Time stamp format differs !!

Hi,

I have attached below the output of the command ls -lt. Why Time stamp format differs !! The older files before Jul 25
are being showed with year instead time.
Any logic behind this ?

14162 Jul 29 12:43 hist1
20480 Jul 26 01:56 expfull_rasdev.log
5470 Jul 25 14:26 trc.prf
456 Jul 8 2002 trace.sql
8171 Jul 8 2002 trace.out
621 Jun 24 2002 custmeasure

Thanks
R. Ezhil
4 REPLIES 4
Michael Tully
Honored Contributor
Solution

Re: Why Time stamp format differs !!

From what I recall, the date/time of a file changes to date/year after 6 months if it hasn;t been modified. This must be actually in weeks (26) as it is not yet quite six months.
Anyone for a Mutiny ?
Bill Hassell
Honored Contributor

Re: Why Time stamp format differs !!

Standard Unix behavior for the ls -l command. From the man page for ls:

"If the time of last modification is greater than six months ago, or any time in the future, the year is substituted for the hour and minute of the modification time."

To have more flexibility, look on the Internet for GNU utilities.


Bill Hassell, sysadmin
Rajeev  Shukla
Honored Contributor

Re: Why Time stamp format differs !!

Thats because HPUX doesn't show info of the time after 6 months. So it the file is older than 6 months what you'll see is only date and year. But i think you can get away with it by using c program and using stat() function and access "st_ctime"
You'll find the exact time of the file modification.
Cheers
rajeev
Steven E. Protter
Exalted Contributor

Re: Why Time stamp format differs !!

I thought it was a year.

Learn something new every day.

P
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com