Subject: Re: standards/24898: emacs thinks mktime is broken
To: None <kleink@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: Greg A. Woods <woods@planix.com>
List: netbsd-bugs
Date: 02/04/2005 23:19:01
The following reply was made to PR standards/24898; it has been noted by GNATS.
From: "Greg A. Woods" <woods@planix.com>
To: "Wolfgang S. Rupprecht" <wolfgang@wsrcc.com>
Cc: jmc@netbsd.org, kleink@netbsd.org,
NetBSD GNATS submissions and followups <gnats-bugs@netbsd.org>,
gnats-admin@netbsd.org
Subject: Re: standards/24898: emacs thinks mktime is broken
Date: Fri, 4 Feb 2005 18:18:08 -0500 (EST)
[ On Tuesday, February 1, 2005 at 15:09:22 (-0800), Wolfgang S. Rupprecht wrote: ]
> Subject: Re: standards/24898: emacs thinks mktime is broken
>
> Is it valid to add an increment to some of the elements of struct tm
> and get reliable answers?
Yes, it is. For example from the manual page:
[[....]] The orig-
inal values of the tm_wday and tm_yday components of the structure are
ignored, and the original values of the other components are not re-
stricted to their normal ranges.
> I've always converted to
> seconds-since-the-epoch, added the increment and converted back.
That's normally what I've done too -- though if you've already got a
"struct tm" handy then it's a lot easier to just add one to tm_day to
advance exactly one day, for example, especially when your goal is to go
back to a canonical time_t value.
--
Greg A. Woods
H:+1 416 218-0098 W:+1 416 489-5852 x122 VE3TCP RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com> Secrets of the Weird <woods@weird.com>