home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / c / 13410 < prev    next >
Encoding:
Text File  |  1992-09-09  |  1.9 KB  |  38 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!usc!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watmath!thinkage!atbowler
  3. From: atbowler@thinkage.on.ca (Alan Bowler)
  4. Subject: Re: file dates
  5. Message-ID: <1992Sep9.211012.16124@thinkage.on.ca>
  6. Organization: /etc/organization
  7. References: <1992Sep8.134608.1255@siesoft.co.uk>
  8. Date: Wed, 9 Sep 1992 21:10:12 GMT
  9. Lines: 27
  10.  
  11. In article <1992Sep8.134608.1255@siesoft.co.uk> tomc@siesoft.co.uk writes:
  12. >Can someone explain to me how to read a files date? I have been looking
  13. >through the manual pages, but there are a lot missing on the machine I
  14. >am using. Basically, I am writing a queue processor, where each job in
  15. >the queue is a file in a specific directory. I just need to be able to
  16. >process these jobs in chronological order, then move the file to another
  17. >directory. Is there an easy way of finding the earliest file in a directory?
  18. >
  19. I suggest that you ask this in a group specific to your operating
  20. system.  When you do be specific about what dat/time you mean.
  21. Different operating systems mainatin a number of different date/time
  22. stamps for each file.
  23.    - when the file was created
  24.    - when the attributes (name, permissions etc) were last changed
  25.    - when the content was last changed
  26.       - This may instead be when the last user that opened it for write
  27.         closed it
  28.       - It may also be when the last user that opened it for write and
  29.         actually wrote somthing closed it
  30.    - when the file was last saved
  31. For a number of systems this information will not be available to an
  32. unprivileged program.  
  33. Also be aware the for some systems (most classical Unix systems
  34. included), gathering this information in the obvious manner
  35. (walk directory and stat'ing every file) may be O(n^2) in the number of
  36. files in the directory.  I have frequently seen cases where time spent
  37. picking the next file took much longer than processing it.
  38.