Skip to content

Add DurationsAsCount preprocessor - #735

Merged
liuzicheng1987 merged 1 commit into
getml:mainfrom
cacharle:add-duration-as-count-preprocessor
Oct 9, 2026
Merged

liuzicheng1987 merged 1 commit into
getml:mainfrom
cacharle:add-duration-as-count-preprocessor

Conversation

@cacharle

@cacharle cacharle commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

This allows to serialize std::chrono durations with their count alone instead of the default count and unit.

This follows the same pattern as UnderlyingEnums by creating an empty preprocessor and using it as a flag to change the duration parsers behavior.

The main reason to have this is to be more compatible with external applications that usually format durations as plain integers and have the unit in the field name (e.g duration_ms: 1000).

This allows to serialize std::chrono durations with their count alone
instead of the default count and unit.
@liuzicheng1987

Copy link
Copy Markdown
Collaborator

@cacharle thanks for the contribution! I am merging this one as well.

@liuzicheng1987
liuzicheng1987 merged commit e01b193 into getml:main Oct 9, 2026
176 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants