PMTIMEVALNOW(3)
π PMTIMEVALNOW(3) β the struct timeval bestie squad π
Library Functions Manual energy, but make it a group chat. Okay so this page lives in the PCP corner of your system and it's all about the little helper routines that do math on time stored as a struct timeval. Yes, the tv_sec/tv_usec one. We love her. π°οΈβ¨
πΈ NAME πΈ
pmtimevalNow, pmtimevalInc, pmtimevalDec, pmtimevalAdd, pmtimevalSub, pmtimevalToReal, pmtimevalFromReal, pmtimevalTotimespec, pmtimevalPrint β the 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 pmtimevalTotimespec(struct timeval *tvp, struct timespec *tsp);
void pmtimevalPrint(FILE *f, const struct timeval *tp);
cc ... -lpcp
Link her up with -lpcp or she simply will not exist, bestie. π
π¦ DESCRIPTION π¦
So. The way that all these functions are literally just little time-gremlins doing math for you? Iconic.
pmtimevalNowis the platform-independent queen π β she hands you the current system time since the Epoch intv.pmtimevalIncadds the time inapto the time inbpand stores the result inap. AndpmtimevalDecdoes the same vibe but backwards β it subtracts the time inbpfrom the time inap, and yes, the result lands back inap. She's an in-place girlie. πpmtimevalAdd(andpmtimevalSub) add (and subtract) times and return the result as adoublevalue. The time in theapargument is not changed β she would never do that to you, no cap. πpmtimevalToRealconverts the time intpto an equivalentdoublevalue. AndpmtimevalFromRealis the reverse conversion, taking the time insecsand returning the equivalent time inval. It's giving glow-up, it's giving transformation. π¦β¨pmtimevalTotimespecconverts thestruct timevaltvpinto an equivalentstruct timespectsp(modulo rounding microseconds up to nanoseconds). Microscopic rounding behavior, but she's honest about it. πpmtimevalPrintprints the timestamp fromtpon the streamfin the local time (as returned bypmLocaltime(3)) in the formatHH:MM:SS.XXX. Slay. β°
π NOTES π
For variants of these interfaces using nanosecond precision and the timespec structure, refer to pmtimespecNow(3). She's the high-precision sister, iykyk. β
π COMPATIBILITY π
Bestie. Listen. Read this part. π
Prior to PCP 7.0 the routine pmtimevalPrint was called pmPrintStamp. To support PMAPI transition, the old routine can still be used if applications are recompiled with -DPMAPI_VERSION=2.
pmPrintStamp is now deprecated and compile-time support for this routine name will be removed in a future release. So likeβ¦ it still works, but she's on her way out. Do not get attached. ππͺ¦
π SEE ALSO π
gettimeofday(2), time(2), PMAPI(3), pmLocaltime(3) and pmtimespecNow(3).
okay that's the whole page bestie you ATE that reading comprehension moment, go touch some grass and come back when you need to do time math ππ
Performance Co-Pilot π«Ά PCP π«Ά PMTIMEVALNOW(3) β mwah, stan, signing off, no cap. π
π
π¦ where this page comes from
- arch rolling: pcp 7.2.2-2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later AND CC-BY-3.0
- centos-stream 10: pcp-doc 7.1.5-6.el10 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.0.1-1.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.2.1-1.fc43
- fedora 43: pcp-doc 7.2.2-1.fc43
- fedora 43: pcp-doc 7.2.2-2.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.1.0-6.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.2.1-1.fc44
- fedora 44: pcp-doc 7.2.2-1.fc44
- fedora 44: pcp-doc 7.2.2-2.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- ubuntu resolute: libpcp4-dev 7.1.1-1
- ubuntu stonking: libpcp4-dev 7.2.1-2build1
- Copyright (c) 2022 Red Hat. All Rights Reserved
- Copyright (c) 2017 Ken McDonell. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms