Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 May 2006 10:32:38 +0200
From:      "Patrick M. Hausen" <hausen@punkt.de>
To:        Peter Jeremy <peterjeremy@optushome.com.au>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: (bsd)tar is broken on 6.1
Message-ID:  <20060527083238.GA30554@hugo10.ka.punkt.de>
In-Reply-To: <20060526105801.GE744@turion.vk2pj.dyndns.org>
References:  <200605251845.k4PIjdx7070553@freefall.freebsd.org> <4476457A.5050800@alumni.rice.edu> <200605260837.k4Q8btpl031485@freefall.freebsd.org> <4476C99C.50200@alumni.rice.edu> <20060526093443.GC94280@hugo10.ka.punkt.de> <20060526105801.GE744@turion.vk2pj.dyndns.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060527083238.GA30554>