---
name: "__pmtimevalConvert"
section: "3"
platform: "linux"
package: "pcp"
version: "7.2.2-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/__pmtimevalConvert"
---

# \_\_pmtimevalConvert(3)

convert tm structure into seconds

## NAME

**\_\_pmtimevalConvert**, **\_\_pmtimespecConvert** - convert **tm** structure into seconds

## C SYNOPSIS

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

**int \_\_pmtimevalConvert(struct tm \****tmin***,** **struct timeval \****origin***,** **struct timeval \****rslt***);**\
 **int \_\_pmtimespecConvert(struct tm \****tmin***,** **struct timespec \****origin***,** **struct timespec \****rslt***);**

**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

**\_\_pmtimevalConvert** and **\_\_pmtimespecConvert** accept a **tm** structure that has been filled in by [**\_\_pmParseCtime**(3)](/__pmParseCtime/3.md) and a reference time point **origin**, and fills in the given **rslt** structure with the time the user meant when specifying a partial **ctime** or positive or negative time **interval**.

Typically, the argument **origin** is the start time for a set of PCP archives, unless the user specified a negative **interval** offset, in which case it is the end time of the archive.

**\_\_pmtimevalConvert** and **\_\_pmtimespecConvert** return 0 if successful. They return -1 and write an error message to **stderr**, if an error is detected.

Use [**pmNewZone**(3)](/pmNewZone/3.md), [**pmNewContextZone**(3)](/pmNewContextZone/3.md) or [**pmUseZone**(3)](/pmUseZone/3.md) to establish a new current timezone that will effect **\_\_pmtimevalConvert**.

## SEE ALSO

[**PMAPI**(3)](/PMAPI/3.md), [**\_\_pmParseCtime**(3)](/__pmParseCtime/3.md), [**\_\_pmtimevalParse**(3)](/__pmtimevalParse/3.md), [**pmNewContextZone**(3)](/pmNewContextZone/3.md), [**pmNewZone**(3)](/pmNewZone/3.md), [**pmParseInterval**(3)](/pmParseInterval/3.md), [**pmParseTimeWindow**(3)](/pmParseTimeWindow/3.md) and [**pmUseZone**(3)](/pmUseZone/3.md).
