Skip to content

Commit 0109168

Browse files
committed
[#39]:svarga:fix, cross-platform chrono detection in BSON consumer and regenerate bson_datetime golden
1 parent a87d442 commit 0109168

2 files changed

Lines changed: 1 addition & 19 deletions

File tree

src/consumer_bson.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ class BsonTemplateCallback : public clang::ast_matchers::MatchFinder::MatchCallb
248248

249249
static bool is_chrono_time_point_(const clang::QualType& qt) {
250250
std::string name = qt.getAsString();
251-
return name.find("std::chrono::time_point") == 0 || name.find("time_point<") != std::string::npos;
251+
return name.find("std::chrono::") != std::string::npos && name.find("time_point") != std::string::npos;
252252
}
253253

254254
// ── type name for emitted code ──

tests/golden/bson_datetime.bson.expected

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,6 @@ struct descriptor {
3939

4040
} // namespace bson::meta
4141

42-
// descriptor for std::chrono::duration
43-
template<>
44-
struct descriptor<std::chrono::duration> {
45-
static constexpr field_desc fields[] = {
46-
{ "__r", bson_type_t::int64, 0, offsetof(std::chrono::duration, __r), false, nullptr, nullptr, nullptr, nullptr }
47-
};
48-
static constexpr std::size_t field_count = 1;
49-
};
50-
51-
// descriptor for std::chrono::time_point
52-
template<>
53-
struct descriptor<std::chrono::time_point> {
54-
static constexpr field_desc fields[] = {
55-
{ "__d", bson_type_t::document, 0, offsetof(std::chrono::time_point, __d), false, nullptr, nullptr, nullptr, nullptr }
56-
};
57-
static constexpr std::size_t field_count = 1;
58-
};
59-
6042
// descriptor for sn::typecheck::Record
6143
template<>
6244
struct descriptor<sn::typecheck::Record> {

0 commit comments

Comments
 (0)