---
name: "__pmparsetime"
section: "3"
platform: "linux"
package: "libpcp3-dev"
version: "4.3.2+really4.3.1-0.1"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://carta.tech/man/__pmParseTime"
---

# \_\_pmparsetime(3)

parse time point specification

Part of [\_\_pmParseTime(3)](/man/__pmParseTime/3.md).

## NAME

**\_\_pmParseTime** - parse time point specification

## C SYNOPSIS

**#include "pmapi.h"**\
 **#include "libpcp.h"**

**int \_\_pmParseTime(const char \****string***, struct timeval \****logStart***, struct timeval \****logEnd***, struct timeval \****rslt***, char \*\****errMsg***);**

**cc ... -lpcp**

## CAVEAT

This documentation is intended for internal Performance Co-Pilot (PCP) developer use.

These interfaces are not part of the PCP APIs that are guaranteed to remain fixed across releases, and they may not work, or may provide different semantics at some point in the future.

## DESCRIPTION

**\_\_pmParseTime** is designed to encapsulate the interpretation of a time point specification in command line switches for use by the PCP client tools.

This function expects to be called with the time point specification as **string**. If the tool is running against PCP archive(s), you also need to supply the start time of the first (only) archive as **logStart**, and the end of the last (only) archive as **logEnd**. See [**pmGetArchiveLabel**(3)](/man/pmGetArchiveLabel/3.md) and [**pmGetArchiveEnd**(3)](/man/pmGetArchiveEnd/3.md) for how to obtain values for these parameters. If the tool is running against a live feed of performance data, **logStart** should be the current time (but could be aligned on the next second for example), while **logEnd** should have its tv\_sec component set to INT\_MAX.

The **rslt** structure must be allocated before calling **\_\_pmParseTime**.

You also need to set the current PCP reporting time zone to correctly reflect the -z and -Z command line parameters before calling **\_\_pmParseTime**. See [**pmUseZone**(3)](/man/pmUseZone/3.md) and friends for information on how this is done.

If the conversion is successful, **\_\_pmParseTime** returns 0, and fills in **rslt** with the time value defined by the input parameters.  If the argument strings could not be parsed, it returns -1 and a dynamically allocated error message string in **errMsg**. Be sure to [**free**(3)](/man/free/3.md) this error message string.

## SEE ALSO

[**PMAPI**(3)](/man/PMAPI/3.md), [**pmGetArchiveEnd**(3)](/man/pmGetArchiveEnd/3.md), [**pmGetArchiveLabel**(3)](/man/pmGetArchiveLabel/3.md), [**pmNewContextZone**(3)](/man/pmNewContextZone/3.md), [**pmNewZone**(3)](/man/pmNewZone/3.md), [**pmParseInterval**(3)](/man/pmParseInterval/3.md), [**pmParseTimeWindow**(3)](/man/pmParseTimeWindow/3.md), [**pmUseZone**(3)](/man/pmUseZone/3.md), [**\_\_pmConvertTime**(3)](/man/__pmConvertTime/3.md) and [**\_\_pmParseCtime**(3)](/man/__pmParseCtime/3.md).
