summaryrefslogtreecommitdiff
path: root/test/testtime.c
diff options
context:
space:
mode:
authorDavid Reid <dreid@apache.org>2001-04-03 20:38:49 +0000
committerDavid Reid <dreid@apache.org>2001-04-03 20:38:49 +0000
commit8abc641528bd63aa29a2ba9812748149795ea029 (patch)
tree0d8c6e8d38f07a8fee8458d9511be1aaa00cc42c /test/testtime.c
parent8741c2a7cde67f368e327617073d63e47f613c1f (diff)
downloadapr-8abc641528bd63aa29a2ba9812748149795ea029.tar.gz
Add an extra check to the time test.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@61449 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/testtime.c')
-rw-r--r--test/testtime.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/test/testtime.c b/test/testtime.c
index 9a74fb274..1d58508d6 100644
--- a/test/testtime.c
+++ b/test/testtime.c
@@ -55,6 +55,7 @@
#include "apr_time.h"
#include "apr_errno.h"
#include "apr_general.h"
+#include "apr_lib.h"
#include <errno.h>
#include <stdio.h>
#ifdef BEOS
@@ -66,28 +67,36 @@ int main(void)
apr_time_t now;
apr_exploded_time_t xt;
apr_time_t imp;
+ apr_pool_t *p;
+ char *str;
+ apr_size_t sz;
fprintf(stdout, "Testing Time functions.\n");
- fprintf(stdout, "\tapr_time_now.......");
+ if (apr_pool_create(&p, NULL) != APR_SUCCESS){
+ printf("Failed to create a context!\n");
+ exit (-1);
+ }
+
+ fprintf(stdout, "\tapr_time_now..................");
now = apr_time_now();
fprintf(stdout, "OK\n");
- fprintf(stdout, "\tapr_explode_localtime.......");
+ fprintf(stdout, "\tapr_explode_localtime.........");
if (apr_explode_localtime(&xt, now) != APR_SUCCESS) {
fprintf(stderr, "Couldn't explode the time\n");
exit(-1);
}
fprintf(stdout, "OK\n");
- fprintf(stdout, "\tapr_explode_gmt.......");
+ fprintf(stdout, "\tapr_explode_gmt...............");
if (apr_explode_gmt(&xt, now) != APR_SUCCESS) {
fprintf(stderr, "Couldn't explode the time\n");
exit(-1);
}
fprintf(stdout, "OK\n");
- fprintf(stdout, "\tapr_implode_time........");
+ fprintf(stdout, "\tapr_implode_time..............");
if (apr_implode_time(&imp, &xt) != APR_SUCCESS) {
fprintf(stderr, "Couldn't implode the time\n");
exit(-1);
@@ -102,6 +111,18 @@ int main(void)
}
fprintf(stdout, "OK\n");
+ printf("\tapr_strftime..................");
+ str = (char*) apr_pcalloc(p, sizeof(char) * 30);
+ if (str == NULL){
+ printf("Couldn't allocate memory.\n");
+ exit (-1);
+ }
+ if (apr_strftime(str, &sz, 30, "%R %A %d %B %Y", &xt) !=
+ APR_SUCCESS){
+ printf("Failed!");
+ }
+ printf("%s\n", str);
+
return 1;
}