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

# pmPrintHighResStamp(3)

helper routines for time stored as a struct timespec

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

## NAME

**pmtimespecNow**, **pmtimespecInc**, **pmtimespecDec**, **pmtimespecAdd**, **pmtimespecSub**, **pmtimespecToReal**, **pmtimespecFromReal**, **pmPrintHighResStamp** - helper routines for time stored as a struct timespec

## C SYNOPSIS

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

**void pmtimespecNow(struct timespec \****tp***);**\
 **void pmtimespecInc(struct timespec \****ap***, const struct timespec \****bp***);**\
 **void pmtimespecDec(struct timespec \****ap***, const struct timespec \****bp***);**\
 **double pmtimespecAdd(const struct timespec \****ap***, const struct timespec \****bp***);**\
 **double pmtimespecSub(const struct timespec \****ap***, const struct timespec \****bp***);**\
 **double pmtimespecToReal(const struct timespec \****tp***);**\
 **void pmtimespecFromReal(double** *secs***, struct timespec \****tp***);**\
 **void pmPrintHighResStamp(FILE \****f***, const struct timespec \****tp***);**

**cc ... -lpcp**

## DESCRIPTION

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

**pmtimespecInc** adds the time in *ap* to the time in *bp* and stores the result in *ap*. Similarly **pmtimespecDec** subtracts the time in *bp* from the time in *ap* and stores the result in *ap*.

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

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

**pmPrintHighResStamp** 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.XXXXXXXXX.

## NOTES

For variants of these interfaces using microsecond precision and the timeval structure, refer to [**pmtimevalNow**(3)](/pmtimevalNow/3.md).

## SEE ALSO

[**PMAPI**(3)](/PMAPI/3.md), [**pmLocaltime**(3)](/pmLocaltime/3.md) and [**pmtimevalNow**(3)](/pmtimevalNow/3.md).
