aboutsummaryrefslogtreecommitdiff
path: root/time/tst-strftime.c
diff options
context:
space:
mode:
authorTulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>2016-07-11 14:16:01 -0300
committerTulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>2016-07-11 14:16:01 -0300
commitbde2a94b61d1cef444d7d4b4b9db70062c48cf5d (patch)
tree5393a8c666de2fb8995df1282909c09ed17d9351 /time/tst-strftime.c
parent3f1ff80d9a0c60398e73d62c52f9a2f06af8d61d (diff)
parent66986dec455c2011085a04b72a5bd55d9f9c7d1c (diff)
downloadglibc-ibm/2.19/master.tar
glibc-ibm/2.19/master.tar.gz
glibc-ibm/2.19/master.tar.bz2
glibc-ibm/2.19/master.zip
Merge branch 'release/2.19/master' into ibm/2.19/masteribm/2.19/master
Conflicts: NEWS
Diffstat (limited to 'time/tst-strftime.c')
-rw-r--r--time/tst-strftime.c52
1 files changed, 51 insertions, 1 deletions
diff --git a/time/tst-strftime.c b/time/tst-strftime.c
index 374fba4262..af3ff72faf 100644
--- a/time/tst-strftime.c
+++ b/time/tst-strftime.c
@@ -4,6 +4,56 @@
#include <time.h>
+static int
+do_bz18985 (void)
+{
+ char buf[1000];
+ struct tm ttm;
+ int rc, ret = 0;
+
+ memset (&ttm, 1, sizeof (ttm));
+ ttm.tm_zone = NULL; /* Dereferenced directly if non-NULL. */
+ rc = strftime (buf, sizeof (buf), "%a %A %b %B %c %z %Z", &ttm);
+
+ if (rc == 66)
+ {
+ const char expected[]
+ = "? ? ? ? ? ? 16843009 16843009:16843009:16843009 16844909 +467836 ?";
+ if (0 != strcmp (buf, expected))
+ {
+ printf ("expected:\n %s\ngot:\n %s\n", expected, buf);
+ ret += 1;
+ }
+ }
+ else
+ {
+ printf ("expected 66, got %d\n", rc);
+ ret += 1;
+ }
+
+ /* Check negative values as well. */
+ memset (&ttm, 0xFF, sizeof (ttm));
+ ttm.tm_zone = NULL; /* Dereferenced directly if non-NULL. */
+ rc = strftime (buf, sizeof (buf), "%a %A %b %B %c %z %Z", &ttm);
+
+ if (rc == 30)
+ {
+ const char expected[] = "? ? ? ? ? ? -1 -1:-1:-1 1899 ";
+ if (0 != strcmp (buf, expected))
+ {
+ printf ("expected:\n %s\ngot:\n %s\n", expected, buf);
+ ret += 1;
+ }
+ }
+ else
+ {
+ printf ("expected 30, got %d\n", rc);
+ ret += 1;
+ }
+
+ return ret;
+}
+
static struct
{
const char *fmt;
@@ -104,7 +154,7 @@ do_test (void)
}
}
- return result;
+ return result + do_bz18985 ();
}
#define TEST_FUNCTION do_test ()