Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!gatech!udel!princeton!jonlab!jon From: jon@jonlab.UUCP (Jon H. LaBadie) Newsgroups: comp.unix.questions Subject: Re: Date: Can it be specific to a shell?? Summary: one minor adjustment is possible Message-ID: <806@jonlab.UUCP> Date: 12 Sep 89 13:09:06 GMT References: <72074@yale-celray.yale.UUCP> <1138@virtech.UUCP> Distribution: usa Organization: 4455 Province Line Rd., Princeton, NJ 08540 Lines: 33 In article <1138@virtech.UUCP>, cpcahil@virtech.UUCP (Conor P. Cahill) writes: > In article <72074@yale-celray.yale.UUCP>, zador-anthony@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