Date: Wed, 16 May 2001 15:36:52 -0500 From: Mike Meyer <mwm@mired.org> To: "Crist Clark" <crist.clark@globalstar.com> Cc: questions@freebsd.org Subject: Re: mktime(3) Bug? Message-ID: <15106.58596.922075.276361@guru.mired.org> In-Reply-To: <8752388@toto.iv>
next in thread | previous in thread | raw e-mail | index | archive | help
Crist Clark <crist.clark@globalstar.com> 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. <mike -- Mike Meyer <mwm@mired.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15106.58596.922075.276361>