Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!bu-cs!bzs From: bzs@bu-cs.BU.EDU (Barry Shein) Newsgroups: comp.unix.questions Subject: Re: Date: Can it be specific to a shell?? Message-ID: <37812@bu-cs.BU.EDU> Date: 9 Sep 89 02:59:10 GMT References: <72074@yale-celray.yale.UUCP> Distribution: usa Organization: Boston U. Comp. Sci. Lines: 36 In-reply-to: zador-anthony@CS.YALE.EDU's message of 9 Sep 89 00:27:47 GMT > How does the UNIX date command know the date? >Is there some file that is updated? >Must date be the same to all shells on a given machine, >or can su selectively adjust the date for a given shell? >If a machine A is the disk server for B, what determines >the date-stamp for a file, A or B? The date is stored in Unix as an integer measured in seconds since "the epoch", January 1 1970. Most systems these days use a finer granularity than seconds but when dates are being used seconds is all that count. This integer can be set by a privileged, system-wide syscall. On many systems it doesn't have to be set often (or ever) because the system has a small battery which keeps the time current even if the system is shut off. There is no provision for modifying the date for one shell. On many Unix systems you can set an environment variable TZ which does alter the timezone for some library calls but that doesn't really change the time, only the way it is presented; 10AM EST is the same time as 9AM CST. Depending on your system, look at the manual pages for time(3C or 2), gettimeofday(2), ctime(3) and timezone(3). The best way to run a piece of software who's license has expired is to trap the time() or gettimeofday() system call in the appropriate debugger :-) -- -Barry Shein Software Tool & Die, Purveyors to the Trade 1330 Beacon Street, Brookline, MA 02146, (617) 739-0202 Internet: bzs@skuld.std.com UUCP: encore!xylogics!skuld!bzs or uunet!skuld!bzs