diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2023-01-22 22:01:51 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2023-01-22 22:01:51 +0200 |
commit | 8be69b967c91de5b5529a0e4a4b5ed862fbe7c7e (patch) | |
tree | 1ee3d89e3ec04f7a115799588395d5185f5732f0 /test | |
parent | cb8aed59b60f39f1ecfd5f283a02aa25fadfa58f (diff) | |
parent | 6e195e45a972b9c88ab8c5627d09049268b29df0 (diff) | |
download | gawk-8be69b967c91de5b5529a0e4a4b5ed862fbe7c7e.tar.gz |
Merge branch 'gawk-5.2-stable'
Diffstat (limited to 'test')
-rw-r--r-- | test/ChangeLog | 6 | ||||
-rw-r--r-- | test/makepmafile.c | 4 | ||||
-rw-r--r-- | test/time.awk | 30 | ||||
-rw-r--r-- | test/time.ok | 2 |
4 files changed, 27 insertions, 15 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 8ea42359..4b750869 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,9 @@ +2023-01-22 Arnold D. Robbins <arnold@skeeve.com> + + * makepmafile.c (main): Make the file mode 0600. + Update copyright year. + * time.awk, time.ok: Add test for strptime(). + 2022-11-25 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am: Use `grep -E' instead of egrep in some of the test diff --git a/test/makepmafile.c b/test/makepmafile.c index c6df717d..8f7d2257 100644 --- a/test/makepmafile.c +++ b/test/makepmafile.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 2022, + * Copyright (C) 2022, 2023, * the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the @@ -38,7 +38,7 @@ main(int argc, char **argv) { size_t four_meg = 1024 * 1024 * 4; char c = 0; - int fd = creat("test.pma", 0666); + int fd = creat("test.pma", 0600); if (fd < 0) { fprintf(stderr, "%s: could not create test.pma: %s\n", diff --git a/test/time.awk b/test/time.awk index 517377e2..377aba45 100644 --- a/test/time.awk +++ b/test/time.awk @@ -4,19 +4,25 @@ # gettimeofday() before systime() to make sure the subtraction gives 0 # without risk of rolling over to the next second. function timecheck(st,res) { - res = gettimeofday() - st = systime() - printf "gettimeofday - systime = %d\n", res-st - return res + res = gettimeofday() + st = systime() + printf "gettimeofday - systime = %d\n", res-st + return res } BEGIN { - delta = 1.3 - t0 = timecheck() - printf "sleep(%s) = %s\n",delta,sleep(delta) - t1 = timecheck() - slept = t1-t0 - if ((slept < 0.9*delta) || (slept > 1.3*delta)) - printf "Warning: tried to sleep %.2f secs, but slept for %.2f secs\n", - delta,slept + delta = 1.3 + t0 = timecheck() + printf "sleep(%s) = %s\n",delta,sleep(delta) + t1 = timecheck() + slept = t1-t0 + if ((slept < 0.9*delta) || (slept > 1.3*delta)) + printf "Warning: tried to sleep %.2f secs, but slept for %.2f secs\n", + delta,slept + + format = "%b %d %H:%M:%S %Y" + the_date = "Feb 11 13:12:11 1990" + then = strptime(the_date, format) + when = strftime(format, then) + print "<" the_date ">", "<<" when ">>" } diff --git a/test/time.ok b/test/time.ok index ffd21696..b781f212 100644 --- a/test/time.ok +++ b/test/time.ok @@ -1,4 +1,4 @@ -gawk: time.awk:2: warning: The time extension is obsolete. Use the timex extension from gawkextlib instead. gettimeofday - systime = 0 sleep(1.3) = 0 gettimeofday - systime = 0 +<Feb 11 13:12:11 1990> <<Feb 11 13:12:11 1990>> |