---
name: "pmPrintStamp"
section: "3"
platform: "linux"
package: "libpcp3-dev"
version: "6.3.8-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/pmtimevalNow"
---

# pmPrintStamp(3)

helper routines for time stored as a struct timeval

Part of [pmtimevalNow(3)](/pmtimevalNow/3.md).

## NAME

**pmtimevalNow**, **pmtimevalInc**, **pmtimevalDec**, **pmtimevalAdd**, **pmtimevalSub**, **pmtimevalToReal**, **pmtimevalFromReal**, **pmPrintStamp** - helper routines for time stored as a struct timeval

## C SYNOPSIS

**#include \<pcp/pmapi.h\>**

**void pmtimevalNow(struct timeval \****tv***);**\
 **void pmtimevalInc(struct timeval \****ap***, const struct timeval \****bp***);**\
 **void pmtimevalDec(struct timeval \****ap***, const struct timeval \****bp***);**\
 **double pmtimevalAdd(const struct timeval \****ap***, const struct timeval \****bp***);**\
 **double pmtimevalSub(const struct timeval \****ap***, const struct timeval \****bp***);**\
 **double pmtimevalToReal(const struct timeval \****val***);**\
 **void pmtimevalFromReal(double** *secs***, struct timeval \****val***);**\
 **void pmPrintStamp(FILE \****f***, const struct timeval \****tp***);**

**cc ... -lpcp**

## DESCRIPTION

**pmtimevalNow** is a platform-independent method that returns the current system time since the Epoch in *tv*.

**pmtimevalInc** adds the time in *ap* to the time in *bp* and stores the result in *ap*. Similarly **pmtimevalDec** subtracts the time in *bp* from the time in *ap* and stores the result in *ap*.

**pmtimevalAdd** (and **pmtimevalSub**) add (and subtract) times and return the result as a double value. The time in the *ap* argument is not changed.

**pmtimevalToReal** converts the time in *tp* to an equivalent double value. **pmtimevalFromReal** provides the reverse conversion, taking the time in *secs* and returning the equivalent time in *val*.

**pmPrintStamp** prints the timestamp from *tp* on the stream *f* in the local time (as returned by [**pmLocaltime**(3)](/pmLocaltime/3.md)) in the format HH:MM:SS.XXX.

## NOTES

For variants of these interfaces using nanosecond precision and the timespec structure, refer to [**pmtimespecNow**(3)](/pmtimespecNow/3.md).

## SEE ALSO

[**gettimeofday**(2)](/gettimeofday/2.md), [**time**(2)](/time/2.md), [**PMAPI**(3)](/PMAPI/3.md), [**pmLocaltime**(3)](/pmLocaltime/3.md) and [**pmtimespecNow**(3)](/pmtimespecNow/3.md).
