summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2010-04-21 18:13:44 +0200
committerAndreas Gruenbacher <agruen@suse.de>2010-04-22 01:32:55 +0200
commitf81fe080e5e73e70f54deb8bab5fe736e374f52e (patch)
treedb6f80ee3b26fa016657c063c854be86e7246d54 /tests
parent369399629764ba06d598d04d94abc3e9a9ad729d (diff)
downloadpatch-f81fe080e5e73e70f54deb8bab5fe736e374f52e.tar.gz
Replace timestamp parsing code with gnulib getdate
* src/Makefile.am (patch_SOURCES): Remove maketime.c, maketime.h, partime.c, and partime.h. (patch_LDFLAGS): Add LIB_CLOCK_GETTIME for clock_gettime(). * src/util.c: Replace maketime.h and partime.h with getdate.h. (fetchname): Replace str2time() with get_date(). Sanitize the test for epoch timestamps. * src/patch.c (main): When --set-utc is given, set the TZ environment variable to UTC so that get_date() will default to UTC timestamps. * tests/preserve-mode-and-timestamp: Switching to get_date() revealed that str2time() was ignoring timezones. In order to test --set-utc now that get_date() fixes this, we must use timestamps that do not include timestamps here. * bootstrap.conf: Add the clock-time, getdate, gettime, and setenv modules.
Diffstat (limited to 'tests')
-rw-r--r--tests/preserve-mode-and-timestamp6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/preserve-mode-and-timestamp b/tests/preserve-mode-and-timestamp
index 7019675..43988bb 100644
--- a/tests/preserve-mode-and-timestamp
+++ b/tests/preserve-mode-and-timestamp
@@ -13,8 +13,8 @@ use_tmpdir
# ==============================================================
-timestamp1="2009-03-13 00:00:00 +0000"
-timestamp2="2009-03-14 00:00:00 +0000"
+timestamp1="2009-03-13 00:00:00"
+timestamp2="2009-03-14 00:00:00"
cat > f.diff <<EOF
--- a/f $timestamp1
+++ b/f $timestamp2
@@ -33,7 +33,7 @@ EOF
# touch -d "$timestamp1" f
# Some non-GNU versions of touch don't support the -d option
-sed_expr='s,\(....\)-\(..\)-\(..\) \(..\):\(..\):\(..\) +\(....\),\1\2\3\4\5.\6,'
+sed_expr='s,\(....\)-\(..\)-\(..\) \(..\):\(..\):\(..\),\1\2\3\4\5.\6,'
timestamp1_touch=`echo "$timestamp1" | sed -e "$sed_expr"`
TZ=UTC touch -t $timestamp1_touch f