Y2k for Unix

Alexey Chupahin achupahi at uic.rsu.ru
Sat Jan 22 19:26:17 AEST 2000

Hello Warren,

I make date2 program now for BSD and Venix. I just send it for you.
This is not best program, only Beta version. Please note me if you find bugs.
To working, it calculates JD time, so algorithm is not best, it requires floating
instructions. JD time is very useful for Astronomicals (my second hobby is
Other  thing - ctime use local time, while stime Grinvich time, if  I remember.
So you may need to add a number of  hours to into the source string to see exact
time you entered:
Time=Time*3600L*24 + (hour+4)*3600L + minutes*60 + sec;

Venix was partically Y2k. I test "find" command with date2 and find (sillogizme!)
it fine.:-).
Seems, Venix with new date2 is full Y2k now.
But BSD and other systems may have a number of non Y2k utilites. I don't like
BSD's ls program for example. It seems work correctly, but I wish to test it
The one way is to copy executable ls from Venix, it works fine on BSD or other way
- I may fix  ls sources and recompile it.

I'm making Y2k features ( that is hardly then for Unix ) for DEC RT-11.
To make this, I use better algorithm to calculate time and better interface, and
if you are interested, I'll port it to Unix too.

I'd like to port Y2k features into Unix 6,7 ,but unfortunatly, it is very
to use "ed" for me. :-) And I don't know how to put files into Unix 6 RL disk - it

May be, we can do well-organized work to prepeare old Unix system to use in
We can make full test all utilites for all versions and fix bugs to make Unixes as
Y2k ready-to-use systems?


P.S. I send you date2.c - sources and executable date2 for BSD and Venix both.
To use it, one can copy date2 into /usr/bin or replace old standard unuseful
$date2 year month day [hour min [sec]]

for example:

$date 2000    1        22   12    15
            ^        ^          ^     ^       ^
           year month    day hour min

date2 without arguments prints date and time.

| "I WAS     living,     |
|  I AM      living and  |
|  I WILL BE living!"    |
|                        |
|         DEC PDP-11...  |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Date2
Type: application/octet-stream
Size: 9110 bytes
Desc: not available
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20000122/7ae8af10/attachment.obj>
-------------- next part --------------
/* Y2k date program for all Unix systems V0.2.2000, beta version. 
   (c) Alex Chupakhin, 17-Jun-2000
   tested on Venix, 2BSD
   Next better version will comes soon.

#include <ctype.h>

int argc;
char **argv;
int year,month,day,hour,minutes,sec;
long mjd();
long Time,time();
char *ctime();

if (argc==1) { Time=time(); printf("%s",ctime(&Time) ); exit(); }
if (argc<4) { printf("Y2k date\nusage\n%s year month day [hour min] [sec]\n",
	        	argv[0]);exit(); }

year =atoi(argv[1]);
day  =atoi(argv[3]);
   hour   = atoi(argv[4]);
   minutes= atoi(argv[5]);
if(argc==7) sec = atoi(argv[6]);

Time = mjd(year,month,day)-mjd(1970,1,1);
Time = Time*3600L*24 + (hour+4)*3600L + minutes*60 + sec;


long mjd(y,m,d)
int y,m,d;
long a,a4,e,c,b;

if(m<=2) { y--; m+=12; }

a=(long) y/100; 
c = (long) (365.25*y);
e = (long) (30.6001*(m+1));
return ( c+e+b+d+1720994L );

More information about the TUHS mailing list