#!/bin/sh
# Exercise timestamps.
# Copyright 2016-2017 Free Software Foundation, Inc.
# 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 .
# limit so don't run it by default.
. "${srcdir=.}/init.sh"; path_prepend_ ..
TZ=UTC0
export TZ
# On platforms supporting timestamps outside gzip's range,
# test that gzip warns when converting them to gzip format.
for time in 190101010000 196912312359.59 197001010000 210602070628.16; do
if touch -t $time in; then
returns_ 2 gzip in || fail=1
fi
rm -f in.gz in
done
# Test that timestamps in range for gzip do not generate warnings.
for time in 197001010000.01 203801190314.07 203801190314.08 210602070628.15; do
if touch -t $time in; then
gzip in || fail=1
fi
rm -f in.gz in
done
# On platforms that fail to support timestamps within gzip's range,
# test that gzip warns when converting them from gzip format.
touch -t 210602070628.15 in || {
printf '\037\213\10\0\377\377\377\377\0\377\3\0\0\0\0\0\0\0\0\0' >y2106.gz ||
framework_failure_
returns_ 2 gzip -Nlv k || fail=1
Exit $fail