Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Year of Unix file

RE: Year of Unix file

From: Brian MacLean <bmaclean_at_vcommerce.com>
Date: Mon, 30 Jul 2001 13:25:12 -0700
Message-ID: <F001.0035959F.20010730132051@fatcity.com>

save the following as fstat.c, compile it with "cc -o fstat fstat.c", then run it as "fstat myfile"

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <time.h>


int rtn;
struct stat buf_st;
struct tm *tm_st;

main( argc, argv, envp)
int argc;
char **argv, **envp;
{

  time_t now;
  if( argc != 2 )
  {

    fprintf( stderr, "Error: number of args\n" );
    exit( 1 );
  }
  rtn = stat( argv[1], &buf_st );
  if( rtn != 0 )
  {

    fprintf( stderr, "stat() return code=%d\n", rtn );
    perror( "error text=" );
    exit(1);
  }
  fprintf( stderr, "FILE=%s\n", argv[1] );
  fprintf( stderr, "SIZE=%d\n", buf_st.st_size );
  fprintf( stderr, "MODE=%d\n", buf_st.st_mode );


  tm_st = localtime( &buf_st.st_mtime );
  fprintf( stderr, "MTIME=%10.10d  -> %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d  ->%s",

    buf_st.st_mtime,
    tm_st->tm_mon + 1, tm_st->tm_mday, tm_st->tm_year - 100,
    tm_st->tm_hour, tm_st->tm_min, tm_st->tm_sec,
    ctime( &buf_st.st_mtime ) );
  tm_st = localtime( &buf_st.st_atime );
  fprintf( stderr, "ATIME=%10.10d  -> %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d  ->%s",

    buf_st.st_atime,
    tm_st->tm_mon + 1, tm_st->tm_mday, tm_st->tm_year - 100,
    tm_st->tm_hour, tm_st->tm_min, tm_st->tm_sec,
    ctime( &buf_st.st_atime ) );
  tm_st = localtime( &buf_st.st_ctime );
  fprintf( stderr, "CTIME=%10.10d  -> %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d  ->%s",

    buf_st.st_ctime,
    tm_st->tm_mon + 1, tm_st->tm_mday, tm_st->tm_year - 100,
    tm_st->tm_hour, tm_st->tm_min, tm_st->tm_sec,
    ctime( &buf_st.st_ctime ) );
  time( &now );
  tm_st = localtime( &now );
  fprintf( stderr, "NOW  =%10.10d  -> %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d  ->%s",

    now,
    tm_st->tm_mon + 1, tm_st->tm_mday, tm_st->tm_year - 100,
    tm_st->tm_hour, tm_st->tm_min, tm_st->tm_sec,
    ctime( &now ) );
  now = 0;
  tm_st = localtime( &now );
  fprintf( stderr, "EPOCH=%10.10d  -> %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d  ->%s",

    now,
    tm_st->tm_mon + 1, tm_st->tm_mday, tm_st->tm_year,
    tm_st->tm_hour, tm_st->tm_min, tm_st->tm_sec,
    ctime( &now ) );

}

-----Original Message-----
From: prasad maganti [mailto:prasadm_g_at_yahoo.com] Sent: Friday, July 27, 2001 4:11 AM
To: Multiple recipients of list ORACLE-L Subject: Year of Unix file

Hi dba's

when i list the unix file (solaris), with ls -lt command , i am able to see the time, month, date that is created.

is there any way to see the year that is created.

any commands....

prasad.



Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: prasad maganti
  INET: prasadm_g_at_yahoo.com


Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Mon Jul 30 2001 - 15:25:12 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US