PMLOCALTIME(3) Library Functions Manual PMLOCALTIME(3)NAME
pmLocaltime - convert the date and time for a reporting timezone
C SYNOPSIS
#include <time.h>
#include <pcp/pmapi.h>
struct tm *pmLocaltime(const time_t *clock, struct tm *result);
cc ... -lpcp
DESCRIPTION
pmLocaltime is very similar to localtime(3), except the timezone used is the current ``reporting timezone'' (rather than the default TZ
environment variable scheme), and the result is returned into a caller-declared buffer (rather than a private buffer).
Like localtime(3) the time to be converted is passed via clock, and the result contains the components broken out in the elements of the tm
struct.
pmLocaltime returns result as the value of the function.
The default current reporting timezone is as defined by the TZ environment variable, so pmLocaltime and localtime(3) will initially produce
a similar encoding of the date and time.
Use pmNewZone(3), pmNewContextZone(3) or pmUseZone(3) to establish a new current reporting timezone that will affect pmLocaltime but not
localtime(3).
SEE ALSO localtime(3), PMAPI(3), pmCtime(3), pmGetConfig(3), pmNewContextZone(3), pmNewZone(3), pmUseZone(3), pcp.conf(5) and pcp.env(5).
Performance Co-Pilot PCP PMLOCALTIME(3)
Check Out this Related Man Page
PMGETARCHIVELABEL(3) Library Functions Manual PMGETARCHIVELABEL(3)NAME
pmGetArchiveLabel - fetch the label record from a performance metrics archive log
C SYNOPSIS
#include <pcp/pmapi.h>
int pmGetArchiveLabel(pmLogLabel *lp);
cc ... -lpcp
DESCRIPTION
Within the framework of the Performance Co-Pilot (PCP), archive logs of performance metrics values may be accumulated and saved using the
program pmlogger(1).
The routine pmGetArchiveLabel may be used to fetch the label record from an archive log that has already been opened using pmNewContext(3),
or pmDupContext(3), and thereby associated with the current Performance Metrics Application Programming Interface (PMAPI) context.
The result returned via the pointer lp is a structure that must be pre-allocated by the caller and has the following format (defined in
pmapi.h).
/*
* Label Record at the start of every log file
*/
typedef struct {
int ll_magic; /* PM_LOG_MAGIC | log format version no. */
pid_t ll_pid; /* PID of logger */
struct timeval ll_start;/* start of this log */
char ll_hostname[PM_LOG_MAXHOSTLEN]; /* name of collection host */
char ll_tz[40]; /* $TZ at collection host */
} pmLogLabel;
For an application, the most useful information from the archive label is likely to be in the fields ll_start, ll_hostname or ll_tz.
Note that the size of the ll_hostname field is PM_LOG_MAXHOSTLEN (64 bytes) which is less than MAXHOSTNAMELEN (see gethostbyname(3)) on
some platforms. These semantics are necessary to retain backwards compatibility with the PCP archive file format.
pmGetArchiveLabel returns zero for success.
PCP ENVIRONMENT
Environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. On each installation, the
file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configura-
tion file, as described in pcp.conf(5). Values for these variables may be obtained programmatically using the pmGetConfig(3) function.
SEE ALSO pmlogger(1), PMAPI(3), pmDupContext(3), pmGetConfig(3), pmNewContext(3), pcp.conf(5) and pcp.env(5).
DIAGNOSTICS
PM_ERR_NOCONTEXT
the current PMAPI context is either invalid, or not associated with an archive log
Performance Co-Pilot PCP PMGETARCHIVELABEL(3)
How to print current date of the Unix system accessing thru C++ program ?
I wrote like this
#include <time.h>
.......
time_t tt;
struct tm *tod;
....
time(&tt);
tod = localtime(&tt);
cout << tod->tm_mon + 1 << "/"
<< tod->tm_mday << "/"
... (6 Replies)
I've date back one of my Unix WS ,after that again i want to return to real date,but after running:
# date -u mmddHHMMyy
the clock immediately returns to GMT timezone that is different with my local timezone.
any suggestion could be useful...
tanx
--nikk (2 Replies)
Hi all,
I am working on a script in which i need to get 4 hrs back time from the current time which i got from this perl function :
`perl -e 'print localtime(time() - 14400) . "\n"'`
now i need to get this in a loop and increment that time by 15 minutes
i.e
i=900(=15minutes)
`perl... (2 Replies)
Hi,
I work on HPUX application and i had a query regarding the sleep & localtime system call in HPUX.
Here is the code that we have :
const uint32_t WAKE_INTERVAL_SEC(30*60);
while (true) {
// Find out what time it is
time(¤tTime);... (3 Replies)
hi there, I have a question about a snippet of code i have which runs localtime() to convert the current date/time into a mysql happy format
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
printf "%4d-%02d-%02d ... (4 Replies)
Hi
I have a command which returns a timezone, Ej:
root@bsades2: /usr/local/bin # lsuser -a time_last_login israel
israel time_last_login=1279032223
Question: I want to parse this timezone '1279032223' into a 'martes, 13 de julio de 2010 16:43:43' from the ksh shell. Is itt possible?
... (3 Replies)
Hi Experts,
I know how to handle normal date changes in perl. Most of my requirement are full filled with following:
$date1 = strftime "%Y%m%d",localtime;
$date2 = strftime "%Y%m%d",localtime(time -24 * 60 * 60);
$date3 = strftime "%Y%m%d",localtime(time +24 * 60 * 60);
$date4 = strftime... (4 Replies)
Hi,
I have given like this to get the time of the sub routine.
my $start = localtime();
print "\n start time: $start \n";
Output
start time: Fri Apr 29 01:01:31 2011
I want to know what is the format of the time.
I am not able to follow is is HH:MM:SS or MM:HH:SS os... (2 Replies)
Hello all,
I know this must be simple .... but i can't grasp what could be the issue.
I'm trying to setup the timezone variable (to the unix command date) according to what i find in a value that i got from parsing the config file.
The end result would be setting the log file with this new... (4 Replies)
Hi
I thought the UNIX command date is universal and so I have been using
date +%z to get the numberic timezone offset (e.g. -0500)
however on HP-UX, this is not returning expected results; on my machine it returns the name of the time zone (e.g. EST) not numbers.
does anyone know... (2 Replies)
Dear all,
I am unable to get the desired result upon executing the below script. the problem is at `perl -le 'print scalar localtime $msecage'` ouput which gives the following result "Thu Jan 1 05:00:00 1970" instead of "Tue Nov 13 10:30:56 2012" but when I run the same command from shell... (2 Replies)
Hello all,
I have the following code that seems to be misbehaving depending on the timezone setting (TZ Environment variable). It gives the correct value when TZ is in POSIX format and the wrong value when in OLSON format.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include... (6 Replies)