Date: Can it be specific to a shell??

Barry Shein bzs at bu-cs.BU.EDU
Sat Sep 9 12:59:10 AEST 1989


> 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 at skuld.std.com
UUCP:     encore!xylogics!skuld!bzs or uunet!skuld!bzs



More information about the Comp.unix.questions mailing list