pmtimeval(3) — Linux manual page

NAME | C SYNOPSIS | DESCRIPTION | NOTES | COMPATIBILITY | SEE ALSO | COLOPHON

PMTIMEVALNOW(3)          Library Functions Manual         PMTIMEVALNOW(3)

NAME         top

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

C SYNOPSIS         top

       #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

DESCRIPTION         top

       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  re‐
       turn 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.

       pmtimevalTotimespec converts the struct timeval tvp into an equiv‐
       alent  struct  timespec  tsp  (modulo  rounding microseconds up to
       nanoseconds).

       pmtimevalPrint prints the timestamp from tp on the stream f in the
       local  time  (as  returned  by  pmLocaltime(3))  in   the   format
       HH:MM:SS.XXX.

NOTES         top

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

COMPATIBILITY         top

       Prior to  PCP  7.0  the  routine  pmtimevalPrint  was  called  pm‐
       PrintStamp.   To  support  PMAPI  transition,  the old routine can
       still be used if applications  are  recompiled  with  -DPMAPI_VER‐
       SION=2.

       pmPrintStamp  is  now deprecated and compile-time support for this
       routine name will be removed in a future release.

SEE ALSO         top

       gettimeofday(2),    time(2),    PMAPI(3),    pmLocaltime(3)    and
       pmtimespecNow(3).

COLOPHON         top

       This  page is part of the PCP (Performance Co-Pilot) project.  In‐
       formation about the project can be found at  ⟨http://www.pcp.io/⟩.
       If  you  have  a  bug  report  for  this  manual  page, send it to
       pcp@groups.io.  This page was obtained from the project's upstream
       Git repository ⟨https://github.com/performancecopilot/pcp.git⟩  on
       2025-08-11.   (At  that  time,  the date of the most recent commit
       that was found in the repository was 2025-08-11.)  If you discover
       any rendering problems in this HTML version of the  page,  or  you
       believe  there is a better or more up-to-date source for the page,
       or you have corrections or improvements to the information in this
       COLOPHON (which is not part of the original manual page),  send  a
       mail to man-pages@man7.org

Performance Co-Pilot               PCP                    PMTIMEVALNOW(3)

Pages that refer to this page: pmtimespec(3)