Ein ähnliches Programm (wenn du die Library verwenden willst):
/* The example takes a number of days
* as input and returns the time, the current
* date, and the specified number of days.
*/
#include <time.h>
#include <stdio.h>
void main( void )
{
struct tm when;
__time64_t now, result;
int days;
_time64( &now );
when = *_localtime64( &now );
printf( "Current time is %s\n", asctime( &when ) );
printf( "How many days to look ahead: " );
scanf( "%d", &days );
when.tm_mday = when.tm_mday + days;
if( (result = _mktime64( &when )) != (time_t)-1 )
printf( "In %d days the time will be %s\n",
days, asctime( &when ) );
else
perror( "_mktime64 failed" );
}
____________________________________
Bibel
|