PMLOCALTIME(3)

πŸ“¦
version 7.2.2 Β· 3 versions
, in arch rolling, centos-stream 10, fedora 43, fedora 44, ubuntu resolute, ubuntu stonking

πŸ’– PMLOCALTIME(3) πŸ’–

okay bestie, welcome to the Library Functions Manual corner of the PCP-verse ✨ this one's short, sweet, and honestly kind of iconic.


🌸 NAME 🌸

pmLocaltime β€” convert the date and time for a reporting timezone πŸ•°οΈ


✨ C SYNOPSIS ✨

#include <time.h>
#include <pcp/pmapi.h>

struct tm *pmLocaltime(const time_t *clock, struct tm *result);

cc ... -lpcp

πŸ¦‹ DESCRIPTION πŸ¦‹

so pmLocaltime is basically localtime(3)'s cooler cousin πŸ’… it does the same lil job, but there are two major glow-ups:

  • the timezone it uses is the current "reporting timezone", not the default TZ environment variable scheme, and
  • the result gets written into a buffer you declare, not some private buffer it keeps to itself πŸ™ˆ

like localtime(3), the time you wanna convert gets passed in through clock, and the result you get back has all the components broken out into the elements of the tm struct πŸŽ€

pmLocaltime returns result as the value of the function. periodt.

the default current reporting timezone is whatever the TZ environment variable defines, so at first pmLocaltime and localtime(3) will produce a similar encoding of the date and time. twin behavior, no cap 🌈

now for the main character move: use pmNewZone(3), pmNewContextZone(3) or pmUseZone(3) to establish a new current reporting timezone. that new zone will affect pmLocaltime but not localtime(3) πŸ‘‘


🫢 SEE ALSO 🫢


and that's the whole page, bestie, you ate it πŸ“ this was Performance Co-Pilot (aka PCP) dropping PMLOCALTIME(3) β€” go forth and convert your timestamps responsibly, mwah πŸ’œπŸŽ€

πŸ“¦ where this page comes from