Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!samsung!usc!snorkelwacker!apple!bionet!ames!eos!shelby!neon!neon!gumby From: gumby@Gang-of-Four.Stanford.EDU (David Vinayak Wallace) Newsgroups: comp.lang.misc Subject: trivial portability (was: Relationship between C and C++) Keywords: portability myth lisp Message-ID: Date: 22 Mar 90 21:47:20 GMT References: <8432@hubcap.clemson.edu> <6515@eos.UUCP> <2944@castle.ed.ac.uk> <970@mti.mti.com> Sender: news@Neon.Stanford.EDU (USENET News System) Organization: Computer Science Department, Stanford University Lines: 18 In-Reply-To: adrian@mti.mti.com's message of 22 Mar 90 18:55:53 GMT Date: 22 Mar 90 18:55:53 GMT From: adrian@mti.mti.com (Adrian McCarthy) Exercise for the reader: write a *portable* program in any language which takes a file name as its parameter and returns the modification or creation date and time of that file. Don't use any conditional compilation. Took longer to trim your message above than it took me to write the code below (in common lisp): (defun demo () (format "~&Enter pathname to examine: ") (let ((pathname (pathname (readline)))) (multiple-value-bind (second minute hour day month year) (decode-universal-time (file-write-date pathname)) (format "The file was written by ~a; on ~D-~D-~D at ~D:~D:~D" (file-author pathname) day month year hour minute second))))