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

M. Warner Losh imp at bsdimp.com
Tue Apr 10 04:21:34 UTC 2007


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:
: > On Mon,  9 Apr 2007 02:19:42 +0000 (UTC) Greg Lehey <grog at FreeBSD.ORG> wrote:
: >> grog        2007-04-09 02:19:37 UTC
: >>
: >>   FreeBSD src repository
: >>
: >>   Modified files:
: >>     usr.bin/touch        touch.1 touch.c
: >>   Log:
: >>   Add -A flag to adjust existing time stamps.
: >> diff -u src/usr.bin/touch/touch.1:1.14 src/usr.bin/touch/touch.1:1.15
: >> --- src/usr.bin/touch/touch.1:1.14	Sun Feb 13 22:25:24 2005
: >> +++ src/usr.bin/touch/touch.1	Mon Apr  9 02:19:37 2007
: >> +.It Fl A
: >> +Adjust the access and modification time stamps for the file by the
: >> +specified value.
: >> +This flag is intended for use in modifying files with a time stamp
: >> +relative to an incorrect time zone.
: >
: > 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).  It cannot be a localtime.  Localtime conversion of time_t
is done by libc to print the local time.

: The case in point is that when importing files from digital cameras,
: it's frequently impossible to get the correct time.  Many cameras are
: too stupid to handle time zones at all and assume it's UTC.  Those
: that can make a typically US assumption that all time zones are on the
: hour.  Here in South Australia, for example, we have a time zone
: offset of +0930, which seems to blow the minds of most cameras.  In my
: case, I have a Canon that fits the first category, and a Nikon that
: fits the second.

FAT doesn't deal in time_t.  It deals in 'local time' only, encoded in
a funky way.

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

Warner


More information about the cvs-src mailing list