[Sunhelp] EXACT!!! creation time of files

Wolfgang Engelien wolfgang at hanazono.med.cornell.edu
Thu Sep 2 20:00:52 CDT 1999


Hello Jim,

you are absolutly right. But in my case the "last modifivation
time" is equal to the "creation time", so I just had to change
the "[10]" into a "[9]" (Dougs email). My main problem was
that I could not think of any standart unix command which
would read out any of these times without losing the exact
seconds. I simply did not think of perl =>> big mistake.

Thanks,
Wolfgang

>Hello Wolfgang,
>
>   On reading your question over it appears that the value you want
>the exact creation date is not available. Look at the stat man page:
>
>You can see what is returned from a stat call. Notice there is no
>creation time returned. The command sent to you will
>return the last access time. To prove this do the following
>run the perl -c command against a file and note the time returned.
>Then do a touch or a vi of the file and rerun the perl -e again.
>You will notice the value returned is the date and time of the 
>last access not the creation time. If you think about it the
>example given was for /etc/hosts. It is highly unlikely that
>the creation date was in the last 3 days on a system which has
>been running.
>
>Below is part of thje man page giving what is returned from
>the stat command. As can be seen the creation time is not kept.
>
> The contents of the structure pointed to by buf include  the
>     following members:
>
>          mode_t   st_mode;     /* File mode (see mknod(2)) */
>          ino_t    st_ino;      /* Inode number */
>          dev_t    st_dev;      /* ID of device containing */
>                                /* a directory entry for this file */
>          dev_t    st_rdev;     /* ID of device */
>                                /* This entry is defined only for */
>                                /* char special or block special files */
>          nlink_t  st_nlink;    /* Number of links */
>          uid_t    st_uid;      /* User ID of the file's owner */
>          gid_t    st_gid;      /* Group ID of the file's group */
>          off_t    st_size;     /* File size in bytes */
>>          time_t   st_atime;    /* Time of last access */
>>          time_t   st_mtime;    /* Time of last data modification */
>>          time_t   st_ctime;    /* Time of last file status change */
>                                /* Times measured in seconds since */
>                                /* 00:00:00 UTC, Jan. 1, 1970 */
>
>So the information about creation time is true only if the file is
>created and never accessed.
>
>
>Regards,
>
>---
>                              : The views expressed are those of the
>                              : author and are not those of: 
>Jim Coby                      : Control Data Systems Inc.
>email                         : James.E.Coby.Jr at cdc.com
>phone                         : 1-800-345-6628 U.S. & Canada
>                              : 612-482-3434   International
>WWW Support Services page     : http://www.cdc.com/support
>
>_______________________________________________
>SunHELP maillist  -  SunHELP at sunhelp.org
>http://www.sunhelp.org/mailman/listinfo/sunhelp
>
#####
# Wolfgang Engelien                       
# Tel.: (212) 746 3724
# Fax.: (212) 746 5818
# email: wolfgang at hanazono.med.cornell.edu
#####






More information about the SunHELP mailing list