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

Support for customizing the BUILT_TIME_UTC format #72

Open
vstojkovic-mongodb opened this issue Oct 30, 2024 · 5 comments
Open

Support for customizing the BUILT_TIME_UTC format #72

vstojkovic-mongodb opened this issue Oct 30, 2024 · 5 comments

Comments

@vstojkovic-mongodb
Copy link

Would it be possible to add an option that controls how the BUILT_TIME_UTC string is formatted?

@lukaslueg
Copy link
Owner

No, because it already is guaranteed to be RFC 2822. But you can feed it through built::util::strptime, and format the resulting object.

@vstojkovic-mongodb
Copy link
Author

Thank you for the quick response. The reason why I asked is because I was hoping to use built as a build dependency only, without having to include it as a runtime dependency.

I would be happy to contribute a PR for this, if you don't have the time to implement it. However, if it goes against what you want for the API of this crate, feel free to close the issue.

@lukaslueg
Copy link
Owner

We could add another item (like DEPENDENCIES: [&str, _] and DEPDENDENCIES_STR: &str), if there is a convincing use case and format.

@vstojkovic-mongodb
Copy link
Author

I apologize, I didn't explain what I mean properly. The reason I asked whether it's possible to customize the format for the BUILT_TIME_UTC is because my use case requires a different format. To get that format, I would have to do what you said and feed the BUILT_TIME_UTC to the built::util::strptime function and then format the result. In order to do that, I have to add built as a runtime dependency.

If I had the option to customize the BUILT_TIME_UTC format inside my build script, I would be able to keep built as a build dependency only and not have to add it as a runtime dependency too.

@lukaslueg
Copy link
Owner

A custom formatter is technically possible - it's just a callback - yet I don't see much use for the API. Your's seems to be a niche case. If your desired format is generic enough, we could add it as a standard-item to built as described above. However, since the whole time-keeping code is extremely small, I'd recommend to simply copy&paste built's krono module into your own build-script and customize the format that way.

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

No branches or pull requests

2 participants