From owner-freebsd-questions Tue May 15 17:43:14 2001 Delivered-To: freebsd-questions@freebsd.org Received: from nsmail.corp.globalstar.com (gibraltar.globalstar.com [207.88.248.142]) by hub.freebsd.org (Postfix) with ESMTP id 2850337B423 for ; Tue, 15 May 2001 17:43:08 -0700 (PDT) (envelope-from crist.clark@globalstar.com) Received: from globalstar.com ([207.88.153.184]) by nsmail.corp.globalstar.com (Netscape Messaging Server 4.15) with ESMTP id GDEKN900.VAG for ; Tue, 15 May 2001 17:42:46 -0700 Message-ID: <3B01CD18.6E725786@globalstar.com> Date: Tue, 15 May 2001 17:43:04 -0700 From: "Crist Clark" Organization: Globalstar LP X-Mailer: Mozilla 4.77 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: freebsd-questions@freebsd.org Subject: mktime(3) Bug? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Before I send in a PR, I wanted to make sure this was really a bug and not some bizarre "feature" everyone already knew about but me. I noticed odd behavior when doing some conversions with date(1) (FreeBSD's date(1) rewls for letting you do these kinds of conversions, BTW). Note what happens when I cross a daylight savings time boundary (which was the 1st of April for my timezone this year), $ date Tue May 15 17:11:52 PDT 2001 $ date -j -f %Y%m%d%H%M 200104020000 Mon Apr 2 00:00:41 PDT 2001 $ date -j -f %Y%m%d%H%M 200104010000 Sat Mar 31 23:00:46 PST 2001 At first I thought it might be a conversion-only problem, but you get the same thing if you _set_ the time across a DST boundary. Looking at the date(1) code and reviewing the manpages, my best guess is that mktime(3) uses the _current_ DST settings when setting the "target" time. That would explain the behavior. And that, IMHO, is a bug. When a user types that second command, he expects to see midnight on the 1st, not 11 PM on the 31st. The DST of the "target" time should be used by mktime(3), not the current one. This is especially true if the user were setting the time rather than just displaying it. This is a bug, right? -- Crist J. Clark Network Security Engineer crist.clark@globalstar.com Globalstar, L.P. (408) 933-4387 FAX: (408) 933-4926 The information contained in this e-mail message is confidential, intended only for the use of the individual or entity named above. If the reader of this e-mail is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any review, dissemination, distribution or copying of this communication is strictly prohibited. If you have received this e-mail in error, please contact postmaster@globalstar.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message