Date: Can it be specific to a shell??
Jon H. LaBadie
jon at jonlab.UUCP
Tue Sep 12 23:09:06 AEST 1989
In article <1138 at virtech.UUCP>, cpcahil at virtech.UUCP (Conor P. Cahill) writes:
> In article <72074 at yale-celray.yale.UUCP>, zador-anthony at CS.YALE.EDU (anthony zador) writes:
> > How does the UNIX date command know the date?
> It performs a time(2) system call which gets the current time in seconds
> (actually this is the count of seconds since Jan 1, 1970 12:00am GMT), the
> ctime(3) library call is then used to generate the date that we all know
> and love.
>
> > Must date be the same to all shells on a given machine,
>
> Yup.
>
> > or can su selectively adjust the date for a given shell?
>
> Nope.
One minor adjustment is possible.
As ctime(3) must adjust the GMT system clock for the local timezone,
a particlular instance of a shell could set the TZ environment variable
to something other than the actual timezone.
Some systems may also allow fractional offsets.
Try:
$ TZ=KST-12KDT ; date # Time in Korea
$ TZ=Twi300000Lit ; date # Time in the Twilite Zone
--
Jon LaBadie
{att, princeton, bcr}!jonlab!jon
{att, attmail, bcr}!auxnj!jon
More information about the Comp.unix.questions
mailing list