BSON_ITER_TIMESTAMP(3)

okay so bestie, welcome to BSON_ITER_TIMESTAMP(3) from libbson πŸ’– this is the timestamp-iterator page and it is lowkey short but highkey important, so let’s get into it ✨

✨ SYNOPSIS ✨

bestie, here’s the exact signature situation:

#define BSON_ITER_HOLDS_TIMESTAMP(iter) \
   (bson_iter_type ((iter)) == BSON_TYPE_TIMESTAMP)

void
bson_iter_timestamp (const bson_iter_t *iter,
                     uint32_t *timestamp,
                     uint32_t *increment);

that macro is the little vibe check β€” it compares bson_iter_type ((iter)) to BSON_TYPE_TIMESTAMP β€” and the function is the actual timestamp grab 🫢

πŸŽ€ PARAMETERS πŸŽ€

  • iter β€” a bson_iter_t. the iterator you’re inspecting, bestie πŸ‘€
  • timestamp β€” a uint32_t.
  • increment β€” a uint32_t.

πŸ’… DESCRIPTION πŸ’…

so the BSON_TYPE_TIMESTAMP type is not a date/time, okay? it’s typically used for intra-server communication. that’s the whole lore. no cap.

you probably want bson_iter_date_time(). like, genuinely, that’s the function you’re looking for if you wanted an actual date/time vibe 🌸

the bson_iter_timestamp() function shall return the contents of a BSON_TYPE_TIMESTAMP element. it is invalid to call this function while observing an element that is not of type BSON_TYPE_TIMESTAMP.

🚨 bestie, do not play with this: calling it on a non-BSON_TYPE_TIMESTAMP element is invalid. that’s the warning, periodt. πŸ’€

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc

2009-present, MongoDB, Inc.


peace out, bestie 🫢 this page is from libbson 2.5.6, dated Oct 09, 2026, and it’s living at the bottom as BSON_ITER_TIMESTAMP(3) β€” slay πŸ’…βœ¨

πŸ“¦ where this page comes from