see the ansi time() function, decribed in the C time.h header file.
Here is my code, in C :
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
/**retrieves the current date.
* the given parameters are filled with the current time values
*/
void retrieve_time(int* day, int* month, int *year)
{
time_t t=time(NULL);
struct tm* timeinfo=localtime(&t);
*day=timeinfo->tm_mday;
*month=timeinfo->tm_mon+1;/*junuary->1 december->12*/
*year=timeinfo->tm_year+1900;
}
int main(void)
{
int day, month, year;
retrieve_time(&day, &month, &year);
if(day==31 && month==10 && year==2005)
{
printf("happy halloween 2005 !\n");
}
return EXIT_SUCCESS;
}