home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <time.h>
- main(int argc,char *argv[])
- {
- FILE *fp;
- char tmp[40],up[40];
- int now,then,sec,min,hour,day,diff;
- if((fp=fopen("t:uupat","r"))==NULL) setup(argv[0]);
- fscanf(fp,"%d",up);
- fseek(fp,0,SEEK_SET);
- fscanf(fp,"%d",&then);
- fclose(fp);
- ucase(argv[0]);
- printf("%c%c%c%c%c%s ",0x1b,0x5b,0x33,0x32,0x6d,argv[0]);
- printf("%c%c%c%cby ",0x1b,0x5b,0x30,0x6d);
- printf("%c%c%c%c%cJim Ahrens\n\n",0x1b,0x5b,0x33,0x33,0x6d);
- printf(" %c%c%c%csystem booted at : %s ",0x1b,0x5b,0x30,0x6d,ctime(up));
- now=time(tmp);
- printf("the current time : %s ",ctime(tmp));
- diff=now-then; day=diff/(60*60*24); diff-=day*(60*60*24);
- hour=diff/(60*60); diff-=hour*(60*60); min=diff/60; sec=diff-(min*60);
- printf("The System has been up for ");
- if(day) printf("%d days ",day);
- if(hour) printf("%d hours ",hour);
- if(min)
- {
- printf("%d minutes and %d seconds\n\n",min,sec);
- exit(0);
- }
- printf("%d seconds\n",sec);
- exit(0);
- }
- setup(name)
- char name[40];
- {
- FILE *fp;
- char tmp[40];
- fp=fopen("t:uupat","w");
- fprintf(fp,"%d",time(tmp));
- fprintf(fp,"This file is needed by %s DO NOT REMOVE IT!\n",name);
- fprintf(fp,"%s by Jim Ahrens © 1992-1993\n",name);
- fclose(fp);
- exit(0);
- }
-