J
__jakal__
Hello,
I need to find out the time difference between UTC and local time.
I am doing it the following way
#include <sys/timeb.h>
#include <stdio.h>
int main()
{
struct timeb tp;
ftime(&tp);
printf("%d", tp.timezone);
}
But the problem is that the timezone value is not adjusted for daylight
saving and always returns local time zone offset.
My TZ environment variable is set to MET
Now the DST rules apply and the offset should be +2 hours
When daylight saving is not in effect, then the offset should be +1 hour.
Is there any way to find out the correct offset . i.e. it should return +2
when DST is in effect and +1 otherwise
Regards,
deep
I need to find out the time difference between UTC and local time.
I am doing it the following way
#include <sys/timeb.h>
#include <stdio.h>
int main()
{
struct timeb tp;
ftime(&tp);
printf("%d", tp.timezone);
}
But the problem is that the timezone value is not adjusted for daylight
saving and always returns local time zone offset.
My TZ environment variable is set to MET
Now the DST rules apply and the offset should be +2 hours
When daylight saving is not in effect, then the offset should be +1 hour.
Is there any way to find out the correct offset . i.e. it should return +2
when DST is in effect and +1 otherwise
Regards,
deep