Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site kovacs.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxj!houxm!ihnp4!zehntel!hplabs!sdcrdcf!randvax!kovacs!rivero
From: rivero@kovacs.UUCP (Michael Foster Rivero)
Newsgroups: net.sources
Subject: tod.c
Message-ID: <201@kovacs.UUCP>
Date: Mon, 14-Jan-85 12:31:57 EST
Article-I.D.: kovacs.201
Posted: Mon Jan 14 12:31:57 1985
Date-Received: Thu, 17-Jan-85 13:41:39 EST
Organization: Robt Abel & Assoc, Hollywood
Lines: 58

I really liked the tod.c posted to net.sources, but decided it should
be a little more personal, so I hacked it to use your login name in
the messages. Enjoy!



-----------------CUT HERE---------------------------------------------------
#include 
#include 

struct tm  *localtime ();
struct tm  *loc_time;

main ()
{
	long clock;
	char tod[5];
	int t_hour, t_min, daytime, tnum;
	char *name;
	char *getlogin();
	name = getlogin();
	time (&clock);
	loc_time = localtime (&clock);
	t_hour = loc_time->tm_hour;
	t_min  = loc_time->tm_min;
	sprintf (tod, "%2d%02d", t_hour, t_min);
	daytime = 5; 		/* Not sure what time it is? */
	tnum = atoi (tod);
	if (tnum >= 0500 && tnum <= 1159)  /* it's morning */
		daytime = 0;
	if (tnum >= 1200 && tnum <= 1759)  /* it's afternoon */
		daytime = 1;
	if (tnum >= 1800 && tnum <= 2359)  /* it's evening */
		daytime = 2;
	if (tnum >= 0000 && tnum <= 0459)  /* it's late! */
		daytime = 3;

	switch(daytime)
	{
	case 0:
		printf ("\nGood Morning %s!\n",name);
		break;
	case 1:
		printf ("\nGood Afternoon %s!\n Only a few more hours to go.",name);
		break;
	case 2:
		printf ("\nGood Evening %s!\n Working late again, I see!\n",name);
		break;
	case 3:
		printf ("\nHey %s!\n Why are you working at this time of night?\n",name);
		break;
	case 4:
		printf ("\nI don't even know what time it is %s\n",name);
	}
}
-----------------CUT HERE---------------------------------------------------
		Mike Rivero
			randvax!kovacs!rivero