2004-03-15 09:11:20 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
# Ensure that a command like
|
|
|
|
|
# `date --date="21:04 +0100" +%S' always prints `00'.
|
|
|
|
|
# Before coreutils-5.2.1, it would print the seconds from the current time.
|
|
|
|
|
|
2006-10-22 19:37:31 +02:00
|
|
|
# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
|
2006-08-17 19:58:17 +00:00
|
|
|
|
2007-07-23 14:35:58 +02:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2006-08-17 19:58:17 +00:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
2007-07-23 14:35:58 +02:00
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
2006-08-17 19:58:17 +00:00
|
|
|
# (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
|
2007-07-23 14:35:58 +02:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2006-08-17 19:58:17 +00:00
|
|
|
|
2004-03-15 09:11:20 +00:00
|
|
|
if test "$VERBOSE" = yes; then
|
|
|
|
|
set -x
|
|
|
|
|
date --version
|
|
|
|
|
fi
|
|
|
|
|
|
2007-09-08 12:26:55 +02:00
|
|
|
. $srcdir/../test-lib.sh
|
2004-03-15 09:11:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
fail=0
|
|
|
|
|
|
2004-03-15 09:39:02 +00:00
|
|
|
# It would be easier simply to sleep for two seconds between two runs
|
|
|
|
|
# of `date --date="21:04 +0100" +%S` and ensure that both outputs
|
|
|
|
|
# are `00', but I prefer not to sleep unconditionally. `make check'
|
|
|
|
|
# takes long enough as it is.
|
|
|
|
|
|
2004-03-15 09:11:20 +00:00
|
|
|
n=0
|
2004-03-15 09:46:47 +00:00
|
|
|
# See if the current number of seconds is `00' or just before.
|
2004-03-15 09:11:20 +00:00
|
|
|
s=`date +%S`
|
|
|
|
|
case "$s" in
|
|
|
|
|
58) n=3;;
|
|
|
|
|
59) n=2;;
|
|
|
|
|
00) n=1;;
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
# If necessary, wait for the system clock to pass the minute mark.
|
2006-12-06 16:36:29 +01:00
|
|
|
test $n = 0 || sleep $n
|
2004-03-15 09:11:20 +00:00
|
|
|
|
|
|
|
|
s=`date --date="21:04 +0100" +%S`
|
|
|
|
|
case "$s" in
|
|
|
|
|
00) ;;
|
|
|
|
|
*) fail=1;;
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
(exit $fail); exit $fail
|