Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filterx: support casting datetime to integer or double #284

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

alltilla
Copy link
Member

No description provided.

@@ -307,6 +308,10 @@ filterx_typecast_integer(FilterXExpr *s, GPtrArray *args)
return filterx_integer_new(val);
}

UnixTime ut;
if (filterx_object_extract_datetime(object, &ut))
return filterx_integer_new(ut.ut_sec * USEC_PER_SEC + ut.ut_usec);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need microsecond precision? What's our use-case here, is this needed to send timestamps to somewhere where usec epoch is the required format or do we just need it for internal reasons?

If the former is the case, we would probably need a conversion function supporting multiple epoch precisions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking more in the other direction, e.g. using nanoseconds precision instead.

The conversion to msec or sec is simple, just divide it by 1000 or 1000000

I'd merge this as is and then maybe do a followup based on the result of the discussion.

@MrAnno MrAnno merged commit 34251b6 into axoflow:main Sep 24, 2024
22 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.

3 participants