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

Time truncation? #9

Open
patti-favaron opened this issue Apr 29, 2023 · 0 comments
Open

Time truncation? #9

patti-favaron opened this issue Apr 29, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@patti-favaron
Copy link
Owner

One of the datetime library uses, and surely the reason its author created it, is to deal with time stamps.

Time stamps can be used in many ways, but two can be considered prominent:

  • Labelling some data gathered by an automatic device with the time instant it was actually read.
  • Assigning a time-dependent file name for collecting time-labelled data.

The second of these uses involves truncation/rounding of times to appropriate averaging intervals, for example one hour, or one day, or ten minutes.

This is simple to accomplish on epoch values: they're integer, and the operations mentioned can be implemented using integer arithmetics.

Time values can then be obtained using appropriate conversion functions, but this requires few code lines when one would be simpler and easier to read.

The truncation operator could be delivered with an operator interface, with a syntax like

tTruncated = tTime  .time_clip.  DTM_ONE_HOUR

where DTM_ONE_HOUR is a public parameter indicating an hour. Other common public parameters could be used as well (I know the author would appreciate any divisor of 3600 between 60 and 3600; the operator should work in any case whatever the integer value of its right argument).

@patti-favaron patti-favaron added the enhancement New feature or request label Apr 29, 2023
@patti-favaron patti-favaron self-assigned this Apr 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant