home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / GENMAN.ZIP / GMTIME.C < prev    next >
C/C++ Source or Header  |  1993-03-13  |  564b  |  37 lines

  1. #include <stdio.h>
  2. #include <sys/types.h>
  3. #include <sys/stat.h>
  4. #include <time.h>
  5.  
  6. main( argc, argv )
  7. int argc;
  8. char **argv;
  9.     {
  10.     struct stat st;
  11.     char *pc;
  12.     char buf[30];
  13.  
  14.     if( argc != 2 )
  15.     {
  16.         printf( "usage\n" );
  17.     exit(-1);
  18.     }
  19.     if( stat( argv[1], &st ) != 0 )
  20.     {
  21.     perror( argv[1] );
  22.     exit(-1);
  23.     }
  24.     pc= asctime( localtime( &st.st_mtime ) );
  25.     if( pc != NULL )
  26.     {
  27.     strcpy( &buf[0], pc+4 );
  28.     buf[6]= ',';
  29.     strcpy( &buf[7], pc+19 );
  30.     printf( "%s", buf );
  31.     }
  32.     else
  33.         printf( "asctime" );
  34.     fflush( stdout );
  35.     exit(0);
  36.     }
  37.