From owner-freebsd-questions Wed May 16 13:36:57 2001 Delivered-To: freebsd-questions@freebsd.org Received: from guru.mired.org (okc-65-26-235-186.mmcable.com [65.26.235.186]) by hub.freebsd.org (Postfix) with SMTP id B49EA37B423 for ; Wed, 16 May 2001 13:36:53 -0700 (PDT) (envelope-from mwm@mired.org) Received: (qmail 87254 invoked by uid 100); 16 May 2001 20:36:52 -0000 From: Mike Meyer MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15106.58596.922075.276361@guru.mired.org> Date: Wed, 16 May 2001 15:36:52 -0500 To: "Crist Clark" Cc: questions@freebsd.org Subject: Re: mktime(3) Bug? In-Reply-To: <8752388@toto.iv> X-Mailer: VM 6.90 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Crist Clark types: > > > This is a bug, right? > > > > I don't think it is a bug. The date/time you give to date(1) is > > interpreted as being in your local timezone. > > What your second example shows is that 2001-04-01 00:00 PDT is the same > > time as 2001-03-31 23:00 PST which I believe is correct. > > I guess an interesting question is, is there really such a thing as > 2001-04-01 00:00 PDT? (Although there is definately a 2001-04-02 01:00 PST.) Yes, there is such a time. I'm not sure if there's any place in the world that is 1) in the Pacific time zone and 2) isn't on DST at that time, but the time exists nonetheless. If you were on Mountain Time, I'd point at Arizona. > I was playing with some file modification times. When I 'ls -l' a directory, > the times on the files for those from before Apr 1 are correct. That is, > since they were created during PST, the times are still given as PST. When > my current timezone shifts to PDT, files that were made in PST still show > the correct PST time. Why would I not expect the same behavior from date(1)? > When I give date(1) a time that occurs in PST, why shouldn't it interpret > it as a PST time? Because you're *not* in PST. The time you gave it doesn't have timezone information, and hence could be any of over two dozen different times. It isn't known to be PST time until *after* you've chosen to interpret it as a specific timezone. Once you've done that - it's to late to interpret it as a different timezone. That it then switches to PST on display is a convenience. You can disable that by setting TZ for the current timezone before invoking the date command. Personally, I think giving date a time sans TZ information should use GMT, but I'm a known curmudgeon. If you still feel it's a bug, PR it and see if the a committer agrees with you. http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message