2009-09-12 14:00:32 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
# touch -t would mistakenly reject a time specifying "60" seconds
|
|
|
|
|
|
2012-01-01 09:47:10 +01:00
|
|
|
# Copyright (C) 2009-2012 Free Software Foundation, Inc.
|
2009-09-12 14:00:32 +02:00
|
|
|
|
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
2010-11-14 11:05:05 +01:00
|
|
|
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
2010-11-17 21:35:31 +01:00
|
|
|
print_ver_ touch
|
2009-09-12 14:00:32 +02:00
|
|
|
|
2011-08-04 20:52:31 +02:00
|
|
|
echo 60.000000000 > exp || framework_failure_
|
2009-09-12 14:00:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# Before coreutils-7.7, this would fail, complaining of
|
2012-01-07 17:47:58 +01:00
|
|
|
# an 'invalid date format'. Specifying 60 seconds *is* valid.
|
2009-09-12 14:00:32 +02:00
|
|
|
TZ=UTC0 touch -t 197001010000.60 f || fail=1
|
|
|
|
|
|
stat: use e.g. %.3X instead of %X.%3:X for sub-second precision
* NEWS: Document this.
* doc/coreutils.texi (stat invocation): Likewise.
* gl/lib/fstimeprec.c, gl/lib/fstimeprec.h, gl/modules/fstimeprec:
* gl/modules/fstimeprec-tests, gl/tests/test-fstimeprec.c:
New files.
* bootstrap.conf (gnulib_modules): Add fstimeprec.
* src/stat.c: Include fstimeprec.h. Don't include xstrtol.h.
(decimal_point, decimal_point_len): New static vars.
(main): Initialize them.
(epoch_sec, out_ns): Remove.
(out_int, out_uint): Now returns whatever printf returned.
(out_minus_zero, out_epoch_secs): New functions.
(print_stat): Use out_epoch_sec instead of out_ns and epoch_sec.
(print_stat, print_it, usage): Remove the %:X-style formats.
* tests/misc/stat-nanoseconds: Set TZ=UTC0 to avoid problems
with weird time zones. Use a time stamp near the Epoch so that we
don't have to worry about leap seconds. Redo test cases to match
new behavior.
* tests/touch/60-seconds: Change %Y.%:Y to %.9Y, to adjust to
new behavior.
2010-11-05 19:35:12 -07:00
|
|
|
stat --p='%.9Y\n' f > out || fail=1
|
2009-09-12 14:00:32 +02:00
|
|
|
|
2011-11-22 10:08:04 +01:00
|
|
|
compare exp out || fail=1
|
2009-09-12 14:00:32 +02:00
|
|
|
|
|
|
|
|
Exit $fail
|