[comp.unix.questions] how to set timezone in BSD

tr@samadams.princeton.edu (Tom Reingold) (02/21/90)

How do you set the timezone on a BSD system?  It defaults to Pacific
time.

I am running AOS, IBM's port of BSD for the RT, which is very close
to the real thing.

Please *post* the answer, don't mail it.

Thanks.

tr@samadams.princeton.edu

jeff@quark.WV.TEK.COM (Jeff Beadles) (02/21/90)

tr@samadams.princeton.edu (Tom Reingold) writes:
>How do you set the timezone on a BSD system?  It defaults to Pacific time.

Move to the west coast?  :-) :-)

I'll give you a hint:

jq:> man date


DATE(1)                 COMMAND REFERENCE                 DATE(1)



NAME
     date - print and set the date

SYNOPSIS
     date [ -u ] [ -z zone ] [ -d daylight_type ] [
     [yy]mmddhhmm[.ss] ]
     [ +format ]

Guess what -z zone does.


	-Jeff
-- 
Jeff Beadles				jeff@quark.WV.TEK.COM 

nelson@mentor.cc.purdue.edu (J. Nelson Howell) (02/22/90)

In article <6214@orca.wv.tek.com> jeff@quark.WV.TEK.COM (Jeff Beadles) writes:
>tr@samadams.princeton.edu (Tom Reingold) writes:
>>How do you set the timezone on a BSD system?  It defaults to Pacific time.
>
>I'll give you a hint:
...
>
>SYNOPSIS
>     date [ -u ] [ -z zone ] [ -d daylight_type ] [
>     [yy]mmddhhmm[.ss] ]
>     [ +format ]

What system does this manual come from?  Not any BSD that I have seen.

>Guess what -z zone does.

It generates a usage message!

	usage: date [-n] [-u] [yymmddhhmm[.ss]]

to be exact.

J. Nelson Howell
System programmer				nelson@midas.mgmt.purdue.edu
Krannert Graduate School of Management		NELSON@PURCCVM.BITNET
Purdue University

pat@orac.pgh.pa.us (Pat Barron) (02/22/90)

In article <24337@princeton.Princeton.EDU> tr@samadams.princeton.edu (Tom Reingold) writes:
>How do you set the timezone on a BSD system?  It defaults to Pacific
>time.
>
>I am running AOS, IBM's port of BSD for the RT, which is very close
>to the real thing.

   In /sys/conf/<YOUR_SYSTEM_NAME>, you will find a line that looks
like:

    timezone   8 dst

The "8" is the number of hours that your time zone is West of GMT.
Change this to the appropriate thing (e.g., for Eastern time, you
would change it to "5"), and rebuild the kernel (i.e., do:

    % cd /sys/conf
    % /etc/config <YOUR_SYSTEM_NAME>
    % cd ../<YOUR_SYSTEM_NAME>
    % make depend
    % make

which produces a vmunix file - move this to /vmunix [but do remember to
save a copy of the old /vmunix first!  Copy it to something like /vmunix.old],
and reboot).

>Please *post* the answer, don't mail it.

Why?  This is pretty basic stuff - and it's even documented.  It's exactly
how you do it for real 4.3BSD.

--Pat.
-- 
Pat Barron
Internet:  pat@orac.pgh.pa.us  - or -   orac!pat@gateway.sei.cmu.edu
UUCP:  ...!uunet!apexepa!sei!orac!pat  - or -  ...!pitt!darth!orac!pat

mlake@irscscm (Marshall Lake) (02/23/90)

In article <6214@orca.wv.tek.com> jeff@quark.WV.TEK.COM (Jeff Beadles) writes:
>
>jq:> man date
>
>
>DATE(1)                 COMMAND REFERENCE                 DATE(1)
>
>
>
>NAME
>     date - print and set the date
>
>SYNOPSIS
>     date [ -u ] [ -z zone ] [ -d daylight_type ] [
>     [yy]mmddhhmm[.ss] ]
>     [ +format ]
>
>

The date command on my BSD system doesn't have the -z option.  I'm
only 4.2 though.

Marshall Lake
mlake@irscscm.UUCP

guy@auspex.auspex.com (Guy Harris) (02/23/90)

>How do you set the timezone on a BSD system?  It defaults to Pacific
>time.
>
>I am running AOS, IBM's port of BSD for the RT, which is very close
>to the real thing.
>
>Please *post* the answer, don't mail it.

OK, if you say so....

Unless the AOS release has the "Arthur Olson" time zone code, you do it
by telling the kernel about it.  You can do that at configuration time,
or by writing a program to use "settimeofday()" to do it.

dce@smsc.sony.com (David Elliott) (02/24/90)

In article <1990Feb22.175400.7713@irscscm> mlake@irscscm.UUCP (Marshall Lake) writes:
>In article <6214@orca.wv.tek.com> jeff@quark.WV.TEK.COM (Jeff Beadles) writes:
>>
>>SYNOPSIS
>>     date [ -u ] [ -z zone ] [ -d daylight_type ] [
>>     [yy]mmddhhmm[.ss] ]
>>     [ +format ]
>
>The date command on my BSD system doesn't have the -z option.  I'm
>only 4.2 though.

I believe that Jeff is running UTek, which is a variant of BSD, not
plain BSD.

Back in the early days of UTek, long before elsie!ado developed the
zoneinfo package, we needed a way to allow customers to set the
timezone on their local systems.  It was not acceptable to have people
reconfigure their systems, as binary reconfigurable kernels were not
yet common (even if we had them, we had 40MB disk systems to support,
so sources, compilers, and even some commands, were optional).

So, we opted for modifying the date command to have it set the
timezone.  As I recall, /etc/rc.local (or whatever we used for this
kind of stuff) looked for a file with the timezone name in it, and ran
date to set the timezone to this value.

For compatability, it wasn't a great move, but in those days it was
more important to be able to have more features (HP-UX was the big
competitor for us) than to be compatible with other systems (of which
there were very few).

-- 
David Elliott
dce@smsc.sony.com | ...!{uunet,mips}!sonyusa!dce
(408)944-4073
"...it becomes natural, like a third sense." -- Homer Simpson

rogerj@batcomputer.tn.cornell.edu (Roger Jagoda) (02/24/90)

In article <2959@auspex.auspex.com> guy@auspex.auspex.com (Guy Harris) writes:
>>How do you set the timezone on a BSD system?  It defaults to Pacific
>>time.
>>
>>I am running AOS, IBM's port of BSD for the RT, which is very close
>>to the real thing.
>>
>>Please *post* the answer, don't mail it.

You got it! Look under /etc (whatever the equivalent is). There should be
also a directory called "zoneinfo" or "TZ" or something like that. Now,
look in that directory for something that looks like a system variable.
On the system I use it's called "localtime." To set the time on this
system, we link (hard link) EST5EDT to that file (ln EST5EDT localtime).
Then used "date" to set the time correctly. A restart of the kernel will
then make sure all your time-stamps are correct.
 
But then, that's my system, your mileage probably will vary!
 
-----------------
Roger Jagoda
FQOJ@CORNELLA.CIT.CORNELL.EDU
 
My management doesn't even like paying me, let alone acknowledging I work
 for them!
-----------------

mlake@irscscm (Marshall Lake) (02/27/90)

In article <208@orac.pgh.pa.us> pat@orac.pgh.pa.us (Pat Barron) writes:
>In article <24337@princeton.Princeton.EDU> tr@samadams.princeton.edu (Tom Reingold) writes:
>>How do you set the timezone on a BSD system?  It defaults to Pacific
>>time.

[stuff deleted]

>
>>Please *post* the answer, don't mail it.
>
>Why?  This is pretty basic stuff - and it's even documented.  It's exactly
>how you do it for real 4.3BSD.
>

... and 4.2

>--Pat.
>-- 
>Pat Barron
>Internet:  pat@orac.pgh.pa.us  - or -   orac!pat@gateway.sei.cmu.edu
>UUCP:  ...!uunet!apexepa!sei!orac!pat  - or -  ...!pitt!darth!orac!pat

Marshall Lake
mlake@irscscm.UUCP

guy@auspex.auspex.com (Guy Harris) (02/27/90)

>You got it! Look under /etc (whatever the equivalent is). There should be
>also a directory called "zoneinfo" or "TZ" or something like that....

>But then, that's my system, your mileage probably will vary!

You bet.  That's the Arthur Olson timezone scheme; if your system has
it, great, but not all systems do.  If there *isn't* a "zoneinfo" in
"/etc" or "/usr/share/lib" or any other "obvious" directory, your system
probably doesn't have it.