BSON_APPEND_DATE_TIME(3)
π BSON_APPEND_DATE_TIME β¨
okay bestie so this is a libbson manual page, section 3, for BSON_APPEND_DATE_TIME(3) β the little function that slides a timestamp into your BSON doc. it's giving "small but mighty" and honestly? iconic. let's get into it π
β¨ SYNOPSIS β¨
#define BSON_APPEND_DATE_TIME(b, key, val) \
bson_append_date_time (b, key, (int) strlen (key), val)
bool
bson_append_date_time (bson_t *bson,
const char *key,
int key_length,
int64_t value);
so there's the macro version (which does the strlen() math for you, so cute of it) and the real function underneath. slay. π«Ά
πΈ PARAMETERS πΈ
bsonβ abson_t. that's the doc you're appending into, your canvas, your main character πkeyβ an ASCII C string with the name of the field. like, the label on the box.key_lengthβ how longkeyis, in bytes. or pass-1and it'll figure the length out withstrlen()for you. lowkey convenient.valueβ the date and time, expressed in milliseconds since the UNIX epoch. that's the whole vibe: a big ol' number of ms. β³
π¦ DESCRIPTION π¦
bson_append_date_time() shall append a new element to a bson document containing a date and time with no timezone information. so like, the timestamp is just a number β it does not come with a little "hey i'm in UTC-5" note attached. π
value is assumed to be in UTC format of milliseconds since the UNIX epoch. and here's the tea: value MAY be negative. yes bestie, you can absolutely go back in time. pre-1970 is allowed, no cap. π₯
π RETURNS π
returns true if the operation was applied successfully. π
the function will fail if appending value grows bson larger than INT32_MAX. so if your doc gets too thicc, it's not happening. know your limits, periodt. π
π AUTHOR π
MongoDB, Inc β the ones who brought you the whole thing. respect. π«‘
π COPYRIGHT π
2009-present, MongoDB, Inc. β all rights reserved, all vibes reserved. β¨
π§ quick vibe check reminder: the ms-since-epoch thing is the entire personality of this function. no timezone, just milliseconds, and negative is totally fine.
and that's the whole page, bestie! this one came from libbson version 2.5.6, dated Oct 09, 2026 β go forth and timestamp responsibly, ily, bye π
ππ
π¦ where this page comes from
- epel 10: libbson-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms