PMCTIME(3)

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

πŸ’– PMCTIME(3) β€” the pmCtime glow-up πŸ’–

okay bestie, so this one lives in the Library Functions Manual and it's a little function called pmCtime and it's literally here to format the date and time for a reporting timezone. cute, right? πŸŽ€


✨ NAME ✨

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


🌸 C SYNOPSIS 🌸

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

char *pmCtime(const time_t *clock, char *buf);

cc ... -lpcp

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so pmCtime is very similar to ctime(3), bestie, with two little twists that make it that girl:

  • the timezone it uses is the current reporting timezone β€” not the default TZ environment variable scheme 🫢
  • the result gets returned into a caller-declared buffer β€” not some private buffer it keeps to itself πŸ™ˆ

Like ctime(3), the time you wanna convert gets passed in via clock, and the result lands in buf as fixed width fields in this format:

Fri Sep 13 00:00:00 1986\n\0
⚠️ okay listen, this matters: the result buffer buf must be at least 26 bytes long, and no attempt is made to check this. so if you skimp on the buffer, that's on you fr fr 😭

pmCtime returns buf as the value of the function. slay πŸ’…

The default current reporting timezone is whatever's defined by the TZ environment variable, so at first pmCtime and ctime(3) will produce similar encoding of the date and time. twins, basically ✨

Wanna change it up? Use pmNewZone(3), pmNewContextZone(3) or pmUseZone(3) to establish a new current reporting timezone β€” and here's the iconic part: that will effect pmCtime but not ctime(3). main character energy only, no cap πŸ‘‘


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole vibe, bestie πŸ’œ this one's brought to you by Performance Co-Pilot (the PCP girlies, you know who you are), and it's filed under PMCTIME(3). go format some timestamps, periodt 🌈🌸

πŸ“¦ where this page comes from