function localtime tm_isdst error?

I have with C this program:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <errno.h>
#include <string.h>


int main (int argc, char argv[])
{
struct tm *auxhoraexacta, *horacompleta;

long fechadomingocerohoras;
long horafinalcompleta;

fechadomingocerohoras = 1256421600;
horafinalcompleta = fechadomingocerohoras 86400;

auxhoraexacta = localtime(&fechadomingocerohoras);
printf("El cambio horario es: %d.......\n", auxhoraexacta->tm_isdst);

horacompleta = localtime(&horafinalcompleta);
printf("El cambio horario es: %d.......\n", auxhoraexacta->tm_isdst);
printf("El cambio horario 24h es: %d.......\n", horacompleta->tm_isdst);
}


The date 1256421600 with spanish time is: 2009/10/25 0:00:00 (tm_isdst is 1)
The date 1256421600 86400 with spanish time is: 2009/10/25 23:00:00 (tm_isdst is 0)
The day 2009/10/25 change the hour, at 3am then 2am


The execution of the program is:
El cambio horario es: 1.......
El cambio horario es: 0.......
El cambio horario 24h es: 0.......



** The program without second localtime is:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <errno.h>
#include <string.h>


int main (int argc, char *argv[])
{
struct tm *auxhoraexacta, *horacompleta;

long fechadomingocerohoras;
long horafinalcompleta;

fechadomingocerohoras = 1256421600;
horafinalcompleta = fechadomingocerohoras + 86400;

auxhoraexacta = localtime(&fechadomingocerohoras);
printf("El cambio horario es: %d.......\n", auxhoraexacta->tm_isdst);

// horacompleta = localtime(&horafinalcompleta);
printf("El cambio horario es: %d.......\n", auxhoraexacta->tm_isdst);
printf("El cambio horario 24h es: %d.......\n", horacompleta->tm_isdst);
}


The execution of the program is:

El cambio horario es: 1.......
El cambio horario es: 1.......


This is a bug?

Best Regards
Cesar Jorge
Please edit your post and put your code in [ code ] tags.
Topic archived. No new replies allowed.