Date: Can it be specific to a shell??

Bill Vermillion bill at bilver.UUCP
Mon Sep 11 13:48:42 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.
->
->> Is there some file that is updated?
->
->Nope.
->
->> Must date be the same to all shells on a given machine, 
->
->Yup.

Believe that answer should be nope.
->
->> or can su selectively adjust the date for a given shell?
->
->Nope.
->
H
How about Yup. 

That is the date is displable in several different time zones, but the machine
time stays the same - UCT (nee GMT).

I just checked.

This machines variable for TZ is set as EST5EDT.  All I did was spawn a
sub-shell and do   TZ=CST6CDT; export TZ.

Then I did a date, and the machine thought I was in Texas (or somewhere in the
Central zone).

It realy has to be this way, as you want local time displayed in the time zone
of the caller.  It makes sense to set TZ variables in the shell if you have
callers spanning time zones.  If someone calls from CA at 9PM PDT, why should
their time display as 1AM EST.  Just set their local variable - the time stamp
on all the files is correct - it's just the display that changes.

It would also be very confusing to have file creation times displayed in the
timezone of the machine, rather than the caller.  I can see it would be very
easy to delete the wrong files - based on time stamps that didn't display
local time.

Yech!

bill

-- 
Bill Vermillion - UUCP: {uiucuxc,hoptoad,petsd}!peora!tarpit!bilver!bill
                      : bill at bilver.UUCP



More information about the Comp.unix.questions mailing list