By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 985 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Handling daylight savings with standard time functions?

P: n/a
Hi,

Is there any way to make time-of-day adjustments for daylight savings
using only standard time functions? We have a program that executes
daily at a fixed time of day. After daylight savings happens, the
time-of-day alignment is lost. For example, if the daily task gets
kicked in at 9 p.m. every evening, after daylight savings ends in
fall, the task is shown as kicking in at 8 p.m. Similarly, if the
daily task gets kicked in at 4 a.m. every morning, after daylight
savings starts in spring, the task is shown as kicking in at 5 a.m.

I tried a few things, including explicitly advancing the day field in
the struct tm structure (sample source code posted to comp.sources.d),
without messing with the seconds, minutes and hours fields. However,
even that is not working. It appears that mktime() is not smart
enough to detect that daylight savings has started/ended.

Any help will be appreciated.

Regards,
Anil

Jul 20 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a

"Generic Usenet Account" <us****@sta.samsung.comwrote in message
news:11**********************@n2g2000hse.googlegro ups.com...
Hi,

Is there any way to make time-of-day adjustments for daylight savings
using only standard time functions? We have a program that executes
daily at a fixed time of day. After daylight savings happens, the
time-of-day alignment is lost. For example, if the daily task gets
kicked in at 9 p.m. every evening, after daylight savings ends in
fall, the task is shown as kicking in at 8 p.m. Similarly, if the
daily task gets kicked in at 4 a.m. every morning, after daylight
savings starts in spring, the task is shown as kicking in at 5 a.m.

I tried a few things, including explicitly advancing the day field in
the struct tm structure (sample source code posted to comp.sources.d),
without messing with the seconds, minutes and hours fields. However,
even that is not working. It appears that mktime() is not smart
enough to detect that daylight savings has started/ended.

Any help will be appreciated.

Why not just use the system time and let it worry about the correct time?

Regards,
Anil

Jul 20 '07 #2

P: n/a
GeekBoy wrote:
"Generic Usenet Account" <us****@sta.samsung.comwrote in message
news:11**********************@n2g2000hse.googlegro ups.com...
>Hi,

Is there any way to make time-of-day adjustments for daylight savings
using only standard time functions? We have a program that executes
daily at a fixed time of day. After daylight savings happens, the
time-of-day alignment is lost. For example, if the daily task gets
kicked in at 9 p.m. every evening, after daylight savings ends in
fall, the task is shown as kicking in at 8 p.m. Similarly, if the
daily task gets kicked in at 4 a.m. every morning, after daylight
savings starts in spring, the task is shown as kicking in at 5 a.m.

I tried a few things, including explicitly advancing the day field in
the struct tm structure (sample source code posted to comp.sources.d),
without messing with the seconds, minutes and hours fields. However,
even that is not working. It appears that mktime() is not smart
enough to detect that daylight savings has started/ended.

Any help will be appreciated.


Why not just use the system time and let it worry about the correct time?

>Regards,
Anil

I notice the US Congress has changed the beginning and end of DST in an
arbitrary and capricious manner this year. So I think system time.
Jul 20 '07 #3

P: n/a
Generic Usenet Account <us****@sta.samsung.comwrote:
>
I tried a few things, including explicitly advancing the day field in
the struct tm structure (sample source code posted to comp.sources.d),
without messing with the seconds, minutes and hours fields. However,
even that is not working. It appears that mktime() is not smart
enough to detect that daylight savings has started/ended.
Did you set the isdst field to some negative value to tell mktime() that
you wanted it to try to figure it out?

-Larry Jones

Things are never quite as scary when you've got a best friend. -- Calvin
Jul 20 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.