diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
commit | 47e6e7c84f008a53061e661f31ae96629bc694ef (patch) | |
tree | 648a07f3b5b9d67ce19b0fd72e8caa1175c98f1a /qa/src/whichtimezone.c | |
download | pcp-debian/3.9.10.tar.gz |
Debian 3.9.10debian/3.9.10debian
Diffstat (limited to 'qa/src/whichtimezone.c')
-rw-r--r-- | qa/src/whichtimezone.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/qa/src/whichtimezone.c b/qa/src/whichtimezone.c new file mode 100644 index 0000000..35cfe0e --- /dev/null +++ b/qa/src/whichtimezone.c @@ -0,0 +1,43 @@ +/* + * Copyright (c) 1997-2001 Silicon Graphics, Inc. All Rights Reserved. + */ + +#include <pcp/pmapi.h> +#include <pcp/impl.h> +#include <time.h> + +int +main(int argc, char *argv[]) +{ + time_t clock; + char *p; + int i; + char buf[28]; + + i = pmLoadNameSpace(PM_NS_DEFAULT); + if (i < 0) { + printf("pmLoadNameSpace: %s\n", pmErrStr(i)); + exit(1); + } + + for (--argc; argc > 0; argc--, argv++) { + printf("Trying %s ...\n", argv[1]); + i = pmNewContext(PM_CONTEXT_HOST, argv[1]); + if (i < 0) { + printf("pmNewContext: %s\n", pmErrStr(i)); + goto more; + } + i = pmNewContextZone(); + if (i < 0) { + printf("pmNewContextZone: %s\n", pmErrStr(i)); + goto more; + } + + i = pmWhichZone(&p); + time(&clock); + printf("zone: %d TZ: %s ctime: %s\n", i, p, pmCtime(&clock, buf)); +more: continue; + } + + exit(0); +} |