PMNEWCONTEXTZONE(3)

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

πŸ’– PMNEWCONTEXTZONE πŸ’–

okay so bestie, welcome to the pmNewContextZone page, part of the Library Functions Manual for PCP ✨ like it literally sets up a reporting timezone based on a PMAPI context, and honestly? iconic behaviour.


🌸 NAME 🌸

pmNewContextZone β€” establish a reporting timezone based on a PMAPI context πŸ•°οΈβœ¨


πŸŽ€ C SYNOPSIS πŸŽ€

#include <pcp/pmapi.h>

int pmNewContextZone(void);
cc ... -lpcp

πŸ’… DESCRIPTION πŸ’…

so here's the tea, bestie. the current reporting timezone is the thing that decides which timezone pmCtime(3) and pmLocaltime(3) are gonna use. it's giving "the vibe setter" fr fr πŸ¦‹

now, pmNewContextZone has two whole moods depending on what your current PMAPI context is:

  • if your current PMAPI context is an archive, it pulls the timezone straight out of the archive label record and uses that to set the current reporting timezone. no cap, it just reads the label πŸ“¦βœ¨
  • if your current PMAPI context corresponds to a host source of metrics, it goes and runs a pmFetch(3) to grab the value for the metric pmcd.timezone, and uses that to set the current reporting timezone 🌈

and in both cases?? it returns a value that identifies the current reporting timezone β€” and you can totally pass that lil value into a later call to pmUseZone(3) to restore this exact reporting timezone. it's literally save-and-restore energy πŸ‘‘


πŸ”₯ DIAGNOSTICS πŸ”₯

  • PM_ERR_NOCONTEXT β€” bestie the current PMAPI context is not valid πŸ˜­πŸ’€
  • other β€” a return value less than zero means a fatal error came out of a system call, and most likely it was malloc(3). yeah. that one.

🫢 SEE ALSO 🫢

PMAPI(3), pmCtime(3), pmFetch(3), pmGetConfig(3), pmLocaltime(3), pmNewContext(3), pmNewZone(3), pmUseZone(3), pmWhichZone(3), pcp.conf(5), pcp.env(5) and environ(7) πŸ’–


Performance Co-Pilot 🌟 PCP 🌟 PMNEWCONTEXTZONE(3)

and that's the whole page bestie, mwah πŸ’‹ go set that reporting timezone, you absolute main character πŸŽ€βœ¨

πŸ“¦ where this page comes from