T
tom
for the following code, gcc compiler will display
it is new day: 20040201
while, VC.NET will display "20040131".
It seems that other comiler will get the same output as gcc.
Does VC.NET break the C standard code?
#include <time.h>
#include <stdio.h>
int main()
{
struct tm today;
time_t currentTime;
char currentDay[10+256+1];
today.tm_year = 104;
today.tm_mon = 1;
today.tm_mday = 1;
today.tm_sec=0; today.tm_min = 0; today.tm_hour =0;
if( mktime(&today) != -1)
{
strftime(currentDay, 16, "%Y%m%d", &today);
printf("it is new day: %s\n", currentDay);
}
}
it is new day: 20040201
while, VC.NET will display "20040131".
It seems that other comiler will get the same output as gcc.
Does VC.NET break the C standard code?
#include <time.h>
#include <stdio.h>
int main()
{
struct tm today;
time_t currentTime;
char currentDay[10+256+1];
today.tm_year = 104;
today.tm_mon = 1;
today.tm_mday = 1;
today.tm_sec=0; today.tm_min = 0; today.tm_hour =0;
if( mktime(&today) != -1)
{
strftime(currentDay, 16, "%Y%m%d", &today);
printf("it is new day: %s\n", currentDay);
}
}