[2274] in cryptography@c2.net mail archive

home help back first fref pref prev next nref lref last post

RSA patent countdown clock, in C.

daemon@ATHENA.MIT.EDU (Perry E. Metzger)
Thu Mar 12 12:09:04 1998

To: cryptography@c2.net
Reply-To: perry@piermont.com
From: "Perry E. Metzger" <perry@piermont.com>
Date: 12 Mar 1998 12:07:47 -0500


I thought this might be of some interest. I hope someone will correct
me if I have the date wrong or otherwise screwed up. I'm curious as to 
what sort of applications people find for this routine...

Perry

----------------------------------------------------------------------

/*
 * RSA patent countdown clock.
 * Written March 11, 1998 by Perry E. Metzger
 * Public Domain -- This code has no copyright, do anything you like
 * to it, though it would be friendly if you gave me credit somewhere.
 */
#include <stdio.h>
#include <time.h>
#include <sys/time.h>

#define SECSPERDAY (24 * 60 * 60)

int
main(int argc, char **argv)
	
{
	struct tm patexp_tm;
	time_t exptime, nowtime, diff;
	int days;
	
	/*
	 * should we set the timezone? Which one? Does the patent
	 * expire at 00:00 on the 20'th, or at 00:00 on the 21st?
	 */
	patexp_tm.tm_sec = 0;
	patexp_tm.tm_min = 0;
	patexp_tm.tm_hour = 0;
	patexp_tm.tm_mday = 20;
	patexp_tm.tm_mon = 8; /* This is Sept., not Aug. */
	patexp_tm.tm_year = 100;

	exptime = mktime(&patexp_tm);
	nowtime = time(NULL);

	printf("Today is:\t\t%s", ctime(&nowtime));
	printf("RSA patent expires:\t%s", ctime(&exptime));

	diff = exptime - nowtime;
	days = diff / SECSPERDAY;

	printf("There are now %d days left until expiry\n", days);
}

home help back first fref pref prev next nref lref last post