Hi,
I wanted to use an example code from Jamsa's book TIP 643 to set date and time exactly one day ahead.
#include <stdio.h>
#include <time.h>
void main(void)
{
time_t seconds;
time( & seconds ); // Get current time
seconds += (time_t) 60 * 60 * 60; // Set date exactly one day ahead
stime( & seconds );
printf("Current Date and Time is: %s", ctime(&seconds) );
}
However, when I compile this code using C compiler from Visual Studio 6.0, It does not recognize stime(). I was wondering if there is an alternative function.
H:\CPROGS\JAMSA>cl -o 643 643.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
643.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:643.exe
/out:643.exe
643.obj
643.obj : error LNK2001: unresolved external symbol _stime
643.exe : fatal error LNK1120: 1 unresolved externals
Hasmukh Daji
I wanted to use an example code from Jamsa's book TIP 643 to set date and time exactly one day ahead.
#include <stdio.h>
#include <time.h>
void main(void)
{
time_t seconds;
time( & seconds ); // Get current time
seconds += (time_t) 60 * 60 * 60; // Set date exactly one day ahead
stime( & seconds );
printf("Current Date and Time is: %s", ctime(&seconds) );
}
However, when I compile this code using C compiler from Visual Studio 6.0, It does not recognize stime(). I was wondering if there is an alternative function.
H:\CPROGS\JAMSA>cl -o 643 643.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
643.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:643.exe
/out:643.exe
643.obj
643.obj : error LNK2001: unresolved external symbol _stime
643.exe : fatal error LNK1120: 1 unresolved externals
Hasmukh Daji