[PATCH 4/4] test: give unique timestamps to messages

David Bremner david at tethera.net
Sun Dec 8 17:18:42 PST 2013


Tomi Ollila <tomi.ollila at iki.fi> writes:

>>      if [ -z "${template[date]}" ]; then
>> -	template[date]="Fri, 05 Jan 2001 15:43:57 +0000"
>> +	template[date]=$(date -Ru -d@$((978709437 - gen_msg_cnt)))
>
> I am afraid this is not portable (although not sure). This could work:
>
> _s=$((3599 - gen_msg_cnt))
> template[date]="Fri, 05 Jan 2001 15:$((_s / 60)):$((_s % 60)) +0000"
>

How about this instead?

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 792e477..22a4d7f 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -356,7 +356,8 @@ generate_message ()
     fi
 
     if [ -z "${template[date]}" ]; then
-	template[date]=$(date -Ru -d@$((978709437 - gen_msg_cnt)))
+	template[date]=$(TZ=UTC printf "%(%a, %d %b %Y %T %z)T\n" \
+			$((978709437 - gen_msg_cnt)))
     fi
 
     additional_headers=""


More information about the notmuch mailing list