aboutsummaryrefslogtreecommitdiffstats
path: root/stdtime/test.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-09-13 20:51:48 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-09-13 20:51:48 +0000
commit8a8d27a2dfa1536f7273579dc7f4886bf9c4cfed (patch)
tree0e8008c721582afe7e8954a6be00bdba448be121 /stdtime/test.c
parente1c164d7893f1d41083c35b5f5ea440df0940961 (diff)
CLeanup PBX patch and add localtime stuff for saytime (bug #168)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1506 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'stdtime/test.c')
-rwxr-xr-xstdtime/test.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/stdtime/test.c b/stdtime/test.c
new file mode 100755
index 000000000..70e2a0c65
--- /dev/null
+++ b/stdtime/test.c
@@ -0,0 +1,20 @@
+/* Testing localtime functionality */
+
+#include "localtime.c"
+#include <sys/time.h>
+#include <stdio.h>
+
+int main(int argc, char **argv) {
+ struct timeval tv;
+ struct tm tm;
+ char *zone[4] = { "America/New_York", "America/Chicago", "America/Denver", "America/Los_Angeles" };
+ int i;
+
+ gettimeofday(&tv,NULL);
+
+ for (i=0;i<4;i++) {
+ ast_localtime(&tv.tv_sec,&tm,zone[i]);
+ printf("Localtime at %s is %04d/%02d/%02d %02d:%02d:%02d\n",zone[i],tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
+ }
+ return 0;
+}