cvs commit: src/usr.bin/touch touch.1 touch.c

Greg 'groggy' Lehey grog at FreeBSD.org
Tue Apr 10 05:00:13 UTC 2007


On Monday,  9 April 2007 at 22:20:11 -0600, M. Warner Losh wrote:
> In message: <20070410010510.GB61460 at wantadilla.lemis.com>
>             "Greg 'groggy' Lehey" <grog at freebsd.org> writes:
>> On Monday,  9 April 2007 at  2:48:26 -0700, Brian Somers wrote:
>>> I don't understand what this means.  File times are in UTC aren't
>>> they?
>>
>> No, they're in time_t.  But if you import files from other systems,
>> you frequently get times which are off by some time zone offset.
>
> time_t is UTC, by definition (sadly, POSIX has enshrined a broken
> definition of UTC as the time_t definition, but that's not important
> right now).

The definition of time_t is simply a number of seconds since a
specified event.  It's true that this event was the turn of the
year/decade in UTC, but that doesn't make it UTC.  Currently my time_t
is 1176181168; that's not directly recognizable as any time zone.

> It cannot be a localtime.  Localtime conversion of time_t is done by
> libc to print the local time.

But libc also needs to convert time_t to UTC.

>> The case in point is that when importing files from digital cameras
>
> FAT doesn't deal in time_t.  It deals in 'local time' only, encoded in
> a funky way.

Right.  And that's the largest part of the problem.

> The rest of what you say is correct, but since there is much confusion
> around time_t I thought I'd be pedantic.

Nothing wrong with being pedantic :-)

Greg
--
See complete headers for address and phone numbers.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20070410/09bcabf4/attachment.pgp


More information about the cvs-src mailing list