Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!amdahl!dlb!sun!cmcmanis From: cmcmanis@sun.uucp (Chuck McManis) Newsgroups: comp.sys.amiga Subject: Re: Getting a timestamp of a file Message-ID: <15312@sun.uucp> Date: Thu, 19-Mar-87 12:43:30 EST Article-I.D.: sun.15312 Posted: Thu Mar 19 12:43:30 1987 Date-Received: Sat, 21-Mar-87 07:29:17 EST References: <2867@sdcsvax.UCSD.EDU> Distribution: na Organization: Sun Microsystems, Inc. - Mtn View, CA Lines: 35 Summary: dos.library and dos are documented in the Bantam book In article <2867@sdcsvax.UCSD.EDU>, Brian Russ writes: > > I wish to find the last time a file has been modified, from > within a C program. From what I've been able to figure, I need > to call Examine() which returns me a struct FileInfoBlock. I > see that this structure has one field called fib_Date or some- > thing (where is this structure documented? RKM and Developer's > Manual were of no help) -- is this the file creation date or > file modification date? How do I transform this structure > (a DateStamp struct, I believe) into human-readable (i.e. month > and day) format? Finally, to call Examine() (and Lock() since > that's what Examine() needs) do I need to open some library? > > Brian Russ Yup, the Lock(), UnLock(), and Examine() calls are part of the dos.library. Fortunately every version of C startup code I have seen opens the dos.library first thing so you don't have to worry about it. The routines are documented in the AmigaDOS Developers Manual which is part of the Bantam Book (which also documents the file system, disked, the CLI, and the system data structures). The timestamp is composed of two longwords one for number of days past 1/1/78 (which happens to be a Sunday) and the second is number of ticks past midnight (1 tick = 1/50th of a second) The date conversion consists of dividing the days by 365 to get the year taking into account leap years , which are more important in calculating the month and date. The day of the week is simply Number_of_Days % 7. Also you can look in the file /libraries/dos.h and /libraries/dosextens.h for this kind of info too! -- --Chuck McManis uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@sun.com These opinions are my own and no one elses, but you knew that didn't you.