code: regress

Download patch

ref: fae865e8a1013e2756b5053e680160eabf92febf
parent: 0850c5b8bb1562625f822fe7b4e7c0da5f5b28f7
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Sep 1 22:00:57 EDT 2020

seconds, date: test that we round trip on local timezones.

--- a/cmd/date.rc
+++ b/cmd/date.rc
@@ -63,7 +63,29 @@
 @{
 	rfork en
 	cat /adm/timezone/US_Arizona >/env/timezone
-	check 'Mon, Jun 21 17:38:02 MST 2020' 1592782682
+	check 'Mon, Jun 21 17:38:02 MST 2020' 1592786282
 }
 
+# CET is a timezone with no hard-coded
+# timezone name -- it should round trip
+@{
+	rfork en
+	cat /adm/timezone/CET >/env/timezone
+	tm=1592782682
+	ds=`{date $tm}
+	r=`{seconds $"ds}
+	if(! ~ $tm $r)
+		>[1=2] echo fail: CET: got $r expected $tm
+}
+
+# The other EST should also round trip.
+@{
+	rfork en
+	cat /adm/timezone/Australia_ACT >/env/timezone
+	tm=1592782682
+	ds=`$nl{date $tm}
+	r=`$nl{seconds $ds}
+	if(! ~ $tm $r)
+		>[1=2] echo fail: Austraila_ACT: got $r expected $tm
+}
 exit ''