PMCONVERTTIME(3)

πŸ’– PMCONVERTTIME(3) β€” the one where we turn a tm into actual seconds πŸ’–

okay bestie, gather round, because this is a page from the Library Functions Manual and it's literally about converting tm structures into seconds. it's giving internal-PCP-developer energy, iykyk 🫢


✨ 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

like, that's the whole vibe right there. two functions, one #include pair, and you link with -lpcp. iconic. πŸŽ€


πŸ’€ CAVEAT πŸ’€

no cap, this one comes with a warning label, and you need to read it.

this documentation is for internal Performance Co-Pilot (PCP) developer use. periodt.

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. 😭

so like… don't build your whole personality around them. they could change on you. fr fr.


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's what's actually happening, bestie.

__pmtimevalConvert and __pmtimespecConvert accept a tm structure that has been filled in by __pmParseCtime(3) β€” plus a reference time point called origin β€” and then they fill in the given rslt structure with the time the user actually meant when they were specifying a partial ctime, or a 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. lowkey important distinction, don't sleep on it πŸ‘‘

__pmtimevalConvert and __pmtimespecConvert return 0 if successful. they return -1 and write an error message to stderr if an error is detected. so like, check that return value, bestie, it's not just decor πŸ’…

use pmNewZone(3), pmNewContextZone(3) or pmUseZone(3) to establish a new current timezone that will effect __pmtimevalConvert. πŸ•°οΈ


🌈 SEE ALSO 🌈

go read those too, they're all part of the same friend group 🫢


and that's the whole page, bestie!! this was brought to you by Performance Co-Pilot (that's the PCP in the corner, mwah) β€” internal dev docs, no guarantees, stay hydrated, and remember: if your timezone is wrong, your conversion is wrong, and that's not a vibe. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…

πŸ“¦ where this page comes from