tevent_helpers(3)

๐Ÿ“ฆ
version 0.17.1 ยท 3 versions
, in centos-stream 10, fedora 43, opensuse-leap 16.0

๐Ÿ’– tevent_helpers โ€” the tevent helper functions ๐Ÿ’–

okay bestie, gather round, because this is the manual page for tevent_helpers โ€” that's section 3 of the library functions manual for tevent, and honestly? it's giving very useful little grab-bag of utility functions. ๐ŸŽ€

It's all about timevals (those struct timeval cuties) and one very smart pid cache. No cap. Let's get into it. ๐Ÿฆ‹


โœจ SYNOPSIS โœจ

๐Ÿ“š Topics

  • The tevent call depth tracking functions โ€” the call depth tracking consists of two parts.

๐Ÿ› ๏ธ Functions

  • int tevent_timeval_compare (const struct timeval *tv1, const struct timeval *tv2) โ€” compare two timeval values.
  • struct timeval tevent_timeval_zero (void) โ€” get a zero timeval value.
  • struct timeval tevent_timeval_current (void) โ€” get a timeval value for the current time.
  • struct timeval tevent_timeval_set (uint32_t secs, uint32_t usecs) โ€” get a timeval structure with the given values.
  • struct timeval tevent_timeval_until (const struct timeval *tv1, const struct timeval *tv2) โ€” get the difference between two timeval values.
  • bool tevent_timeval_is_zero (const struct timeval *tv) โ€” check if a given timeval structure is zero.
  • struct timeval tevent_timeval_add (const struct timeval *tv, uint32_t secs, uint32_t usecs) โ€” add the given amount of time to a timeval structure.
  • struct timeval tevent_timeval_current_ofs (uint32_t secs, uint32_t usecs) โ€” get a timeval in the future with a specified offset from now.
  • pid_t tevent_cached_getpid (void) โ€” a cached version of getpid().

๐ŸŒˆ Detailed Description

Todo: description

(yeah bestie, the docs literally say "todo" here. iconic of them honestly. ๐Ÿ™ˆ that's all the detailed description we get!)


๐Ÿ”ฅ Function Documentation ๐Ÿ”ฅ

๐Ÿงš pid_t tevent_cached_getpid (void )

A cached version of getpid(). We use getpid() in a lot a performance critical situations in order to check if caches are still valid in the current process.

Calling getpid() always add the cost of an additional syscall! ๐Ÿ˜ญ

When tevent is build with pthread support, we already make use of pthread_atfork(), so it's trivial to use it maintain a cache for getpid().

Returns

  • The pid of the current process. ๐Ÿ’œ

๐Ÿ“ struct timeval tevent_timeval_add (const struct timeval * tv, uint32_t secs, uint32_t usecs)

Add the given amount of time to a timeval structure.

Parameters

  • tv โ€” The timeval structure to add the time.
  • secs โ€” The seconds to add to the timeval.
  • usecs โ€” The microseconds to add to the timeval.

Returns

  • The timeval structure with the new time. โœจ

โญ int tevent_timeval_compare (const struct timeval * tv1, const struct timeval * tv2)

Compare two timeval values.

Parameters

  • tv1 โ€” The first timeval value to compare.
  • tv2 โ€” The second timeval value to compare.

Returns

  • 0 if they are equal. 1 if the first time is greater than the second. -1 if the first time is smaller than the second.

Compare two timeval values.

Return -1 if tv1 < tv2 Return 0 if tv1 == tv2 Return 1 if tv1 > tv2


๐Ÿซถ struct timeval tevent_timeval_current (void )

Get a timeval value for the current time.

Returns

  • A timeval value with the current time. ๐Ÿ•

Get a timeval value for the current time.


๐Ÿ’… struct timeval tevent_timeval_current_ofs (uint32_t secs, uint32_t usecs)

Get a timeval in the future with a specified offset from now.

Parameters

  • secs โ€” The seconds of the offset from now.
  • usecs โ€” The microseconds of the offset from now.

Returns

  • A timeval with the given offset in the future. ๐Ÿ”ฎ

Get a timeval in the future with a specified offset from now.


๐ŸŒธ bool tevent_timeval_is_zero (const struct timeval * tv)

Check if a given timeval structure is zero.

Parameters

  • tv โ€” The timeval to check if it is zero.

Returns

  • True if it is zero, false otherwise. ๐Ÿ’€

Check if a given timeval structure is zero.


๐ŸŽ€ struct timeval tevent_timeval_set (uint32_t secs, uint32_t usecs)

Get a timeval structure with the given values.

Parameters

  • secs โ€” The seconds to set.
  • usecs โ€” The microseconds to set.

Returns

  • A timeval structure with the given values. ๐Ÿ’–

Get a timeval structure with the given values.


๐Ÿฆ‹ struct timeval tevent_timeval_until (const struct timeval * tv1, const struct timeval * tv2)

Get the difference between two timeval values.

Parameters

  • tv1 โ€” The first timeval.
  • tv2 โ€” The second timeval.

Returns

  • A timeval structure with the difference between the first and the second value.

Get the difference between two timeval values.


๐Ÿ‘‘ struct timeval tevent_timeval_zero (void )

Get a zero timeval value.

Returns

  • A zero timeval value.

Get a zero timeval value.


โœ๏ธ Author

Generated automatically by Doxygen for tevent from the source code.


okay that's the whole page, bestie!! ๐Ÿฅณ this was tevent_helpers(3), from tevent, Version 0.9.8, and the manual page name is, you guessed it, tevent_helpers(3). go forth and timeval responsibly!! ๐Ÿ’œโœจ๐ŸŽ€