View Full Version : Setting Time on Ancient UNIX (circa 1985-1986)

March 8th, 2015, 06:58 PM
Does anyone here remember a good way to execute a set time command on this vintage of UNIX?

Again, I'm running CTIX, which is a Convergent Technologies port of UNIX System V release 2.2.

I'm still on the hunt for user manuals to answer questions like this.

By default, I use the AT&T UNIX PC manuals, and that page seems less than intuitive to me.

WARNING: entire 800-page volume linked here:
ATT UNIX PC System V Users Manual Volume 1 opened right to TIME(1) (http://bitsavers.trailing-edge.com/pdf/att/3b1/999-801-312IS_ATT_UNIX_PC_System_V_Users_Manual_Volume_1.p df#page=375)


March 8th, 2015, 09:02 PM
Have you tried

date 0308210215

That should set the date to the moment I made this post (Pacific standard time ;) ). Try setting the year to 95 first though in case you hit a Y2K bug.

March 11th, 2015, 12:16 AM
NeXT, you are absolutely correct. I knew it had to be something just that simple.

Here are the things that I tried.


MightyFrame CTIX (tm: Convergent Technologies) User Mode

login: root

NODE: RLS5.11, VERSION: CTIX5.11onb, RELEASE: S5.2.2, DATE: 01/21/85
Welcome to MightyFrame CTIX (trademarks of Convergent Technologies).
# date
Mon Jan 21 16:41:08 PST 1985
# date 0311001085
Mon Mar 11 00:10:00 PST 1985
# date
Mon Mar 11 00:10:09 PST 1985
# date 0311001215
Wed Mar 11 00:12:00 PST 1970
# date 031100122015
Thu Mar 12 00:12:00 PST 1970
# date 031100121999
Wed Mar 11 00:12:00 PST 1970
# date 0311001299
Thu Mar 11 00:12:00 PST 1999

Even though the MightyFrame displays a 4-digit date, it does not appear Y2K compliant. This model and OS build having been designed in 1985-1986, that is not at all surprising.

March 11th, 2015, 05:37 AM
I know you don't have any manual pages. Does your "date(1)" command have a usage message? Try "date -q" or something to try to get one. That may give you more information about what "date(1)" is willing to do. For example, look at all the info my recent BSD system gives:

% date -q
date: illegal option -- q
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]

FYI, the comment at the top of the "date" command from Version 7 UNIX (/usr/src/cmd/date.c, dated January 10, 1979) says:

* date : print date
* date YYMMDDHHMM[.SS] : set date, if allowed
* date -u ... : date in GMT

You can try this format and see what you can do with it. But the V7 code does not attempt to deal with dates after 1999, so the chance of complete success this way is low.

I know you have a working C language environment, so I suspect your best option will be to get the current time in seconds since the epoch and use a system call to set the time.and date. Your program must run as the superuser to do this. In early UNIX there was a "stime( *tp )" call where tp is a "long *tp;". Later versions of UNIX use the "int settimeofday(const struct timeval *tp, const struct timezone *tzp);" I don't really know when this changeover occurred.

March 11th, 2015, 06:04 AM
I have read that CTIX is derived from AT&T UNIX System III, so I am a little surprised to see the S5.2.2 in your login info. There is an archive out there called sys3.tar.gz which includes sources for a PDP-11 version of UNIX System III. Apparently the current owner of the copyright has issued an "Ancient UNIX License" that allows use and distribution of this code. The "stime()" system call still exists in this version, and so it probably exists in CTIX as well. The source code for the date command is still in /usr/src/cmd/date.c; it is a bit later than the V7 code, but still does not have a usage message. If you get this archive and extract the source for the date command you can probably change the line of code that sets the century in function "gtime()" and have something working in short order.

UNIX Heritage Society link (http://www.tuhs.org/) - link to The UNIX Tree (http://minnie.tuhs.org/cgi-bin/utree.pl)

EDIT: I have good reason to believe that the "stime()" system call is still used in System V, so the System III code will probably work fine.

March 11th, 2015, 06:32 AM
I can't resist making a silly remark on UNIX guys having trouble getting a date ;)

March 11th, 2015, 06:35 AM
I can't resist making a silly remark on UNIX guys having trouble getting a date ;)

Funny, but not accurate. Getting a date is easy. *Controlling* the date can be difficult.

March 11th, 2015, 08:48 AM
Every so often I find that Irix has a command whose syntax has not changed in a long, long time. Thankfully Irix keeps all command information accessible through the OS using the "man" command however if you lack an Irix box, you can still look it all up in the techpubs.

date(1) (http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=0650&db=man&fname=/usr/share/catman/u_man/cat1/date.z)

March 11th, 2015, 08:51 AM
Have you looked at these manuals (http://bitsavers.trailing-edge.com/pdf/att/unix/System_V_Release_2/)? The stime(2) system call is on page 137 of the PDF file for the UNIX Programmer's Manual volume 2 (http://bitsavers.trailing-edge.com/pdf/att/unix/System_V_Release_2/UNIX_Programmers_Manual_Vol_2_System_Calls_and_Lib rary_Routines_1986.pdf).