[En-Nut-Discussion] Is this a bug or a feature in mktime?

Dave ethernut at wormfood.org
Thu Jun 9 13:07:21 CEST 2005


On Thu, 2005-06-09 at 06:51 -0400, Dave wrote:
> Hi everyone,
>    I'm not sure if this is a bug or a feature. I've been playing around
> with the mktime function, and I noticed that if set the date to a time
> of the year, so that it is opposite of how tm_isdst is currently set,
> then my time will be ahead or behind by one hour.
> 
>    For example, if the tm_isdst flag is clear, and I enter todays date
> with a time of 6:00, it will set the tm_isdst flag, and put my time at
> 7:00. If the tm_isdst flag is set, and I set the date to December and
> the time to 6:00, then it will clear the tm_isdst flag, and set the time
> to 5:00.
> 
>    Is it supposed to work this way? In my eyes it is a bug, but that may
> be the way it is supposed to work. I'm sure I can 'fix' it, but I don't
> want to break something else if it is supposed to work this way. Can
> someone let me know before I try to fix something that may not be
> broken?
> 
> -Dave


I got it figured out. It is not documented 100% in the Nut/OS docs, but
it appears that it is supposed to work this way, and if I simply set the
tm_isdst flag to -1 it will automagically set the tm_isdst flag for me,
and set the time as expected.

-Dave




More information about the En-Nut-Discussion mailing list