Category : Files from Magazines
Archive   : CUJ9301.ZIP
Filename : 1101116B
#include
#include
#include
main()
{
time_t start, stop;
struct tm *now;
int ndays;
/* Get current date and time */
time(&start);
now = localtime(&start);
/* Enter an interval in days */
fputs("How many days from now? ",stderr);
if (scanf("%d",&ndays) != 1)
return EXIT_FAILURE;
now->tm_mday += ndays;
if (mktime(now) != -1)
printf("New date: %s",asctime(now));
else
puts("Sorry. Can't encode your date.");
/* Calculate elapsed time */
time(&stop);
printf("Elapsed program time in seconds: %f\n",
difftime(stop,start));
return EXIT_SUCCESS;
}
/* Output
How many days from now? 45
New date: Fri Nov 20 12:40:32 1992
Elapsed program time in seconds: 1.000000
*/
/* End of File */
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/