(bsd)tar is broken on 6.1

Patrick M. Hausen hausen at punkt.de
Sat May 27 01:32:45 PDT 2006


Hi, all!

On Fri, May 26, 2006 at 08:58:01PM +1000, Peter Jeremy wrote:
> On Fri, 2006-May-26 11:34:43 +0200, Patrick M. Hausen wrote:
> >> > -rw-r--r--  1 jmz  jmz    4312 Apr 16  1947 supclkrd.prg
> 
> >Since there cannot be a date before January 1st 1970, 0:00 on
> >any Unix system, i guess there's something seriously broken here.
> 
> Why do you say that?  time_t is signed so it can represent a date
> prior to 1970.  In theory, a file prepared on an earlier computer
> could have been transferred onto a Unix system whilst retaining
> its original modification time.

If I'm not mistaken, the signedness of time_t is merely historical.
time_t predates explicitely unsigned integer data types in C.
The historical definition seems to have been "long".
Dates before the Epoch are undefined.

I mean, which part of "seconds since the Epoch" implies time
values _before_ the Epoch?

You are not supposed to do calculations subtractions with time_t
but use difftime(), for example.

POSIX.1-1990.  Section 2.2.2.77: seconds since the Epoch

"If the year < 1970 or the value [of seconds since the Epoch] is
 negative, the relationship is undefined.  If the year >= 1970 and the
 value is non-negative, the value is related to a Coordinated Universal
 Time name ..."

Regards,
Patrick
-- 
punkt.de GmbH         Internet - Dienstleistungen - Beratung
Vorholzstr. 25        Tel. 0721 9109 -0 Fax: -100
76137 Karlsruhe       http://punkt.de


More information about the freebsd-stable mailing list